/*
================================================================================
                        Los Santos Xtreme DM/Freeroam
    		   ------------------ Script Info -----------------
		       | Founder(s): Ben Ravetta (AKA PawnStar/Jerome)|
			   | Script status: Development. Approaching Beta |
			   | Script availablity: NON-PUBLIC (05/2010)     |
			   | Built for: SA:MP 0.3a                        |
			   | Plugins utilized: sscanf, streamer plugin    |
      		   | ,irc plugin, audio                           |
			   | Times re-written: Once, re-written for 0.3a  |
			   | Initial dev. start date: Summer 2009 (GMT)   |
			   | Developers: B.Ravetta                        |
			   | Outstanding credits: Zh3r0, we used a few of |
			   | his maps from "The Eclipse", thanks!         |
	    	   ------------------------------------------------

*/

//--------------------------- Let's begin ----------------------------------------------------//

#include <a_samp>
#include <lsx_includes>
#include <C-Serial>

#define LVXVersion 1.6.4
#define LASTUPDATE "Monday, 1st August, 2011."
#define TIMEUPDATE +18:00

// 1 - yes | 0 - no
#define LOCALHOST 1 // This option when enabled will stop IRC connecting and NPC bots will not connect.
#define CHRISTMAS_BUILD 0 // Christmas time!? :D
#define BETA_BUILD 1 // Is this a BETA build?!
#define DEBUG 1

#undef MAX_PLAYERS
    #define MAX_PLAYERS 20 // Change to how many slots we're using. Remember to compensate for NPCs

#if LOCALHOST == 1 // Change to 1 for localhost testing
	#define IRC_ENABLED 0
	#define CONNECT_BOTS 0
#else
    //NPC Handling
	#define CONNECT_BOTS 1 // Do we want the NPC's to connect, or not? 1 for yes, 0 for no/
    // Are we including IRC in this build?
	#define IRC_ENABLED 1
#endif

#define URL_STRING "www.playlsx.net" // Website

//--------------- CONFIG OPTIONS ----------------------
#define MAX_CCTVS 100
#define MAX_CCTVMENUS 10  //(This number should be MAX_CCTVS divided by 10  (round up))
#define GIVECASH_DELAY 5000
#define CDIVE_DELAY 5000
#define V_RESPAWN_TIME      300 // Seconds. 5 minutes.
#define A_RESPAWN_TIME      60  // Seconds. 1 minute.
#define AFK_KICK_ENABLED true // switch to false to disable
#define AFK_TIME 12000 // 15 minutes AFK before you are kicked
#define DEFAULT_SPAWN_DIST 180
#define AVERROR "Access to this vehicle is prohibited to the public."
#define AV_RESPAWN_TIME 5000 // Admin vehicles
#define TAXI_WAIT_TIME 120000 // Time it takes until player can use taxi again.


// Object RELATED
#define INVALID_OBJECT_SLOT -255

// gPos
#define MAX_gPOSITIONS 200

// ------ Map Load options ------//
// Comment out to unload...
#define INIT_MAP_BDESERT 1 // Main base (/pp)
#define INIT_MAP_MYLAND 1 // Endgame code (B1) /b1

#define USE_MENUS       	// Comment out to remove all menus.  Uncomment to enable menus
#define DISPLAY_CONFIG 	    // displays configuration in console window on filterscript load
#define SAVE_LOGS           // Comment out if your server runs linux (logs wont be saved)
#define ENABLE_SPEC         // Comment out if you are using a spectate system already
#define USE_STATS           // Comment out to disable /stats
#define ANTI_MINIGUN        // Displays who has a minigun
//#define HIDE_ADMINS 		// Displays number of admins online instead of level and names
#define ENABLE_FAKE_CMDS   	// Comment to disable /fakechat, /fakedeath, /fakecmd commanads

#define CASH_PRIZE 2500000 //This is the prize that the player will win when killing the terrorist!
#define WEAPON_ID 34 //This is the weapon id that all players will recieve to help kill him!
#define WEAPON_AMMO 400 //this is the ammo!
//#define STUNT_PARK   // Uncommented will create the stuntpark at SF Driving school.

#define fuckoff "Not enough money!"

#define MAX_WARNINGS 3      // /warn command

#define MAX_REPORTS 7
#define MAX_CHAT_LINES 7

#define SPAM_MAX_MSGS 5
#define SPAM_TIMELIMIT 4 // SECONDS

#define PING_MAX_EXCEEDS 4
#define PING_TIMELIMIT 60 // SECONDS

#define MAX_FAIL_LOGINS 3

#define MAX_WORLD 300000000

//Audio
#if CHRISTMAS_BUILD == 1
new Christmas_Song;
#endif

#define POCKET_DOSH 2500 // Amount player gets on spawning
#define CP_DRIVETHRU1 0 // A random failure

// Caps
#define UpperToLower(%1) for ( new ToLowerChar; ToLowerChar < strlen( %1 ); ToLowerChar ++ ) if ( %1[ ToLowerChar ]> 64 && %1[ ToLowerChar ] < 91 ) %1[ ToLowerChar ] += 32

// Spec
#define ADMIN_SPEC_TYPE_NONE 0
#define ADMIN_SPEC_TYPE_PLAYER 1
#define ADMIN_SPEC_TYPE_VEHICLE 2

//Christmas
#if CHRISTMAS_BUILD == 1
#define MAX_GIFT_MONEY 5000000
#endif

#define MAX_PROPERTIES 200
#define MAX_PROPERTIES_PER_PLAYER 200
#define UNBUYABLETIME 15  //If a property is bought, someone else have to wait this number of minutes before he/she can buy it.

#define ENABLE_MAP_ICON_STREAMER 0

#define MAX_POINTS 1
#define MAX_BANK 1
#define MAX_CPOINTS 1

#define MAX_GANGS 			32
#define MAX_GANG_MEMBERS	30
#define MAX_GANG_NAME       20

#define CASH_MONET 2000000

#define MAX_ACCOUNT_MONEY 200000000

#define LICENCE_COST 20000

#define MAX_XACCOUNT_DOSH 450000000
#define xACCOUNT_COST 50000000

//----------------------------------------------


// We'll define Macros in here instead of the include.
#define IsPlayerPaused(%1) GetTickCount() > (lastupdate[%1]+2000)
#define HidePlayerDialog(%1) ShowPlayerDialog(%1, -1, 0, " ", " ", " ", " ")

//Dialog ID's
#define LOGIN 			1
#define DUEL_WEAPONS 	2
#define DUEL_PLACES 	3
#define DUEL_DECLINE 	4
#define JAIL_HELP 		5
#define MYTIME_DIALOG 	6
#define LEAVE_MSG_DIALOG_INITIAL 	7
#define LEAVE_MSG_DIALOG_EDIT   	8

#define SERVER_NAME "Los Santos Xtreme"

//#define IRC_SERVER "irc.sa-mp.com" // new
#define IRC_SERVER "irc.gtanet.com" // Home :(
#define IRC_PORT (6697)
#define IRC_CHANNEL "#PlayLSX.echo"

#if IRC_ENABLED == 1

// Keys
#define VIP_KEY "sentinelslair"
#define CREW_KEY "demigodzrunthis"

#define BOT_1_NICKNAME "m00p1"
#define BOT_1_REALNAME "Connected to LSX"
#define BOT_1_USERNAME "PlayLSX_1"

#define BOT_2_NICKNAME "m00p2"
#define BOT_2_REALNAME "Connected to LSX"
#define BOT_2_USERNAME "PlayLSX_2"

#define CHAT_CHAN "#PlayLSX"
#define CREW_CHAN "#PlayLSX.crew"
#define VIP_CHAN "#PlayLSX.vip"
#define MAX_BOTS (2)

new
	gBotID[MAX_BOTS],
	gGroupID;

#endif

// Audio variables
new StreamID[MAX_PLAYERS];
new ChristmasPlay[MAX_PLAYERS];
// Chase
forward VehicleTimerHealth(playerid);
new IsGameOn;
new PlayerHitman[200];
new lolz[128];
new colorp[200];

// Export vars
#define MAX_WANTEDVEH	20
new Export_CP;
new wantedVehicles[MAX_WANTEDVEH] =
{
    581, 463, 533, 575, 535, 567,
	495, 420, 562, 560, 549, 496,
	541, 415, 558, 522, 471, 568,
	589, 587
};

new wantedVehicle[3];
new amountWantedVehicle[3];

#if CONNECT_BOTS == 1
new NPCPoliceHeli, BlackOpsHeli_1, BlackOpsRancher;
#endif

//--------------- CCTV
//----------------------------------------------------------------------------//
//------------- Surveillance Handler original code by =>Sandra<= -------------//



//CameraInfo
new TotalCCTVS;
new CameraName[MAX_CCTVS][32];
new Float:CCTVLA[MAX_PLAYERS][3];  //CCTV LookAt
new Float:CCTVLAO[MAX_CCTVS][3];
new Float:CCTVRadius[MAX_PLAYERS]; //CCTV Radius
new Float:CCTVDegree[MAX_PLAYERS] = 0.0;
new Float:CCTVCP[MAX_CCTVS][4]; //CCTV CameraPos
new CurrentCCTV[MAX_PLAYERS] = -1;

//TextDraw
new Text:TD;

//Christmas stuff
#if CHRISTMAS_BUILD == 1
new giftPickup;
new giftRunning;
new giftID;

new Text:Christmas;
new Text:Year;
#endif

//Menus:
new Menu:CCTVMenu[MAX_CCTVMENUS];
new MenuType[MAX_CCTVMENUS];
new TotalMenus;
new PlayerMenu[MAX_PLAYERS];
new Vehicle[ MAX_VEHICLES ];

enum LP
{
	Float:LX,
	Float:LY,
	Float:LZ,
	Float:LA,
	LInterior
}
new Spawned2[MAX_PLAYERS];
new LastPos[MAX_PLAYERS][LP];

new KeyTimer[MAX_PLAYERS];
//-------

//Countdown
new IsCountdownStarted;
new IsPlayerCountdownStarted[MAX_PLAYERS];
new PlayerCountdownCount[MAX_PLAYERS];
new CountdownCount;
new PlayerCountdownTimer[MAX_PLAYERS];
new CountdownTimer;

// Props
new PropertiesAmount;
new PropertyPickup[MAX_PROPERTIES];
new Text3D:Prop3D;
new Text3D:pTag[MAX_PLAYERS];
new Text3D:Dyna_3D; // Property 3D labels
new MP;
new PropCount;
enum propinfo
{
	PropName[64],
	Float:PropX,
	Float:PropY,
	Float:PropZ,
	PropIsBought,
	PropUnbuyableTime,
	PropOwner[MAX_PLAYER_NAME],
	PropInt,
	PropValue,
	PropEarning,
	PickupNr,
	PropExists
};
new PropInfo[MAX_PROPERTIES][propinfo];
new PlayerProps[MAX_PLAYERS];
#define MAX_DISTANCE_TO_PROPERTY 1.5
new EarningsForPlayer[MAX_PLAYERS];
// ---------------- Property Stocks and publics/forwards ---------------------//

stock LoadProperties()
{
	if(fexist("lsx/PropertySystem/PropertyInfo.txt"))
	{
	    CountProperties();
		new Argument[9][70];
		new entry[128];//, BoughtProps;
		new File: propfile = fopen("lsx/PropertySystem/PropertyInfo.txt", io_read);
	    if (propfile)
		{
		    for(new id; id<PropertiesAmount; id++)
			{
			    new string[64];
				fread(propfile, entry);
				split(entry, Argument, ',');
    			format(PropInfo[id][PropName], 64, "%s", Argument[0]);
				PropInfo[id][PropX] = floatstr(Argument[1]);
				PropInfo[id][PropY] = floatstr(Argument[2]);
				PropInfo[id][PropZ] = floatstr(Argument[3]);
				PropInfo[id][PropInt] = strval(Argument[4]);
				PropInfo[id][PropValue] = strval(Argument[5]);
				PropInfo[id][PropEarning] = strval(Argument[6]);
				//format(PropInfo[id][PropOwner], MAX_PLAYER_NAME, "%s", Argument[6]);
				//PropInfo[id][PropIsBought] = strval(Argument[7]);
				//PropInfo[id][PropUnbuyableTime] = strval(Argument[8]);
				PropertyPickup[id] = CreateDynamicPickup(19267, 1, PropInfo[id][PropX], PropInfo[id][PropY], PropInfo[id][PropZ], -1, -1, -1);
				PropInfo[id][PropExists] = 1;
				format(string, sizeof(string), "[%s]\nPurchased: No\nEarns: $%i\nPrice: $%i",PropInfo[id][PropName], PropInfo[id][PropEarning], PropInfo[id][PropValue]);
				Prop3D = Create3DTextLabel(string,COLOR_BLUE,PropInfo[id][PropX],PropInfo[id][PropY],PropInfo[id][PropZ]+0.6,40.0,0,1);
				if(PropInfo[id][PropIsBought] == 1)
				{
				    PropInfo[id][PropIsBought] = 0;
				}
			}
			fclose(propfile);
			printf("===================================");
			printf("||    Created %d Properties      ||", PropertiesAmount);
			printf("===================================");
		}
	}
}

stock DestroyAllPropertyPickups()
{
	for(new ID=1; ID<MAX_PROPERTIES; ID++)
	{
		DestroyDynamicPickup(PropertyPickup[ID]);
	}
}
/*
stock GetPropertyID(name)
{
	for(new p=1; p < MAX_PROPERTIES; p++)
	{
	    if(PropInfo[p][name])
	    {
	        return p;
		}
	}
	return 1;
}
*/

stock CreateProperty(name[], Float:X, Float:Y, Float:Z, Interior, Value, Earning)
{
	PropCount++;
	new ID = PropCount, string[128];
	PropInfo[ID][PropExists] = 1;
 	format(PropInfo[ID][PropName], 60, "%s", name);
	PropInfo[ID][PropX] = X;
	PropInfo[ID][PropY] = Y;
	PropInfo[ID][PropZ] = Z;
	PropInfo[ID][PropInt] = Interior;
	PropInfo[ID][PropValue] = Value;
	PropInfo[ID][PropEarning] = Earning;
	PropInfo[ID][PropOwner] = -1;
	PropertyPickup[ID] = CreateDynamicPickup(19267, 1, X, Y, Z, -1, -1, -1);
	SaveProperty(ID);
	format(string, sizeof(string), "[%s]",PropInfo[ID][PropName]);
	Dyna_3D = Create3DTextLabel(string,COLOR_BLUE,PropInfo[ID][PropX],PropInfo[ID][PropY],PropInfo[ID][PropZ]+0.6, 40.0, 0, 1);
	return ID;
}

stock IsPlayerNearProperty(playerid)
{
	for(new i=1; i<MAX_PROPERTIES; i++)
	{
	    if(IsPlayerInRangeOfPoint(playerid, MAX_DISTANCE_TO_PROPERTY, PropInfo[i][PropX], PropInfo[i][PropY], PropInfo[i][PropZ]))
	    {
	        return i;
		}
	}
	return -1;
}

stock OnPropertyPickupPickup(playerid, pickupid)
{
 	new propid = -1;
	for(new i=1; i<MAX_PROPERTIES; i++)
	{
	    if(pickupid == PropertyPickup[i])
	    {
	        propid = i;
			break;
		}
	}
	if(propid != -1)
	{
		if(PropInfo[propid][PropUnbuyableTime] > 0)
        {
            new str[128]; new str2[128];
            SendClientMessage(playerid,MANAGEMENT,"--------------------------------------------------");
            format(str, 128, "*** %s", PropInfo[propid][PropName]);
			format(str2, 128, "This property is already owned by %s. You'll have to wait %d minutes before you can buy it.", PropInfo[propid][PropOwner], PropInfo[propid][PropUnbuyableTime]);
	        SendClientMessage(playerid,MANAGEMENT, str);
	        SendClientMessage(playerid,MANAGEMENT, str2);
            SendClientMessage(playerid,MANAGEMENT,"--------------------------------------------------");
			return 1;
		}
		if(PropInfo[propid][PropUnbuyableTime] < 1)
		{
		    new str[128]; new str2[128];
			SendClientMessage(playerid,MANAGEMENT,"--------------------------------------------------");
			format(str, 128, "*** %s", PropInfo[propid][PropName]);
			format(str2, 128, "This property is available for $%d and will earn you $%d every 15 minutes", PropInfo[propid][PropValue], PropInfo[propid][PropEarning]);
		    SendClientMessage(playerid,MANAGEMENT, str);
		    SendClientMessage(playerid,MANAGEMENT, str2);
		    SendClientMessage(playerid,MANAGEMENT,"--------------------------------------------------");
		}
	}
	return 1;
}

forward OnPlayerBuyProperty(playerid, PName[]);
public OnPlayerBuyProperty(playerid, PName[])
{
	return 1;
}

stock SaveProperty(propertyID)
{
    if(PropInfo[propertyID][PropExists] == 0) return 0;
	new ID = propertyID;
    new File:hFile;
	if(!fexist("lsx/PropertySystem/PropertyInfo.txt"))
	{
		hFile=fopen("PropertyInfo.txt",io_write);
		fclose(hFile);
		print("File 'PropertyInfo.txt' created succesfully!");
	}
	new Float:X = PropInfo[ID][PropX];
	new Float:Y = PropInfo[ID][PropY];
	new Float:Z = PropInfo[ID][PropZ];
	new Int = PropInfo[ID][PropInt];
	new Price = PropInfo[ID][PropValue];
	new Earning = PropInfo[ID][PropEarning];
    new entry[128], entry2[128];
	format(entry, 128, "\"%s\", %.2f, %.2f, %.2f, %d, %d, %d", PropInfo[ID][PropName], X, Y, Z, Int, Price, Earning);
	format(entry2, 128, "\r\n%s",entry);
	hFile = fopen("lsx/PropertySystem/PropertyInfo.txt", io_append);
	fwrite(hFile, entry2);
	fclose(hFile);
	return 1;
}

stock fdeleteline(filename[], line[])
{
	if(fexist(filename))
	{
		new temp[128];
		new File:fhandle = fopen(filename,io_read);
		fread(fhandle,temp,sizeof(temp),false);
		if(strfind(temp,line,true)==-1){return 0;}
		else
		{
			fclose(fhandle);
			fremove(filename);
			for(new i=0;i<strlen(temp);i++)
			{
				new templine[128];
				strmid(templine,temp,i,i+strlen(line));
				if(equal(templine,line,true)){
					strdel(temp,i,i+strlen(line));
					fcreate(filename);
					fhandle = fopen(filename,io_write);
					fwrite(fhandle,temp);
					fclose(fhandle);
					return 1;
				}
			}
		}
	}
	return 0;
}

stock TeleportMsg(playerid, area[])
{
	new string[128];
	format(string, sizeof(string), "%s[%d] has teleported to %s", pName(playerid),playerid,area);
	MessageToAdminsEx(playerid, AREA_MSG, string);
	printf("%s", string);
	return 1;
}
#if IRC_ENABLED == 1
stock IRCTeleportMsg(playerid, area[])
{
	new string[128];
	format(string, sizeof(string), "7%s[%d] 10has teleported to %s", pName(playerid),playerid,area);
	IRC_Say(gGroupID, IRC_CHANNEL, string);
	IRC_Say(gGroupID, CREW_CHAN, string);
	return 1;
}
#endif

#if CHRISTMAS_BUILD == 1
forward ShowChristmasText(playerid);
public ShowChristmasText(playerid)
{
	TextDrawShowForPlayer(playerid, Christmas);
	TextDrawShowForPlayer(playerid, Year);
	return 1;
}

forward HideChristmasText(playerid);
public HideChristmasText(playerid)
{
	TextDrawHideForPlayer(playerid, Christmas);
	TextDrawHideForPlayer(playerid, Year);
	return 1;
}
#endif
//------------------- CCTV FUNCTIONS ----------------
forward CheckKeyPress(playerid);
public CheckKeyPress(playerid)
{
    new keys, updown, leftright;
    GetPlayerKeys(playerid, keys, updown, leftright);
	if(CurrentCCTV[playerid] > -1 && PlayerMenu[playerid] == -1)
	{
	    if(leftright == KEY_RIGHT)
	  	{
	  	    if(keys == KEY_SPRINT)
			{
	 	    	CCTVDegree[playerid] = (CCTVDegree[playerid] - 2.0);
			}
			else
			{
			    CCTVDegree[playerid] = (CCTVDegree[playerid] - 0.5);
			}
	  	    if(CCTVDegree[playerid] < 0)
	  	    {
	  	        CCTVDegree[playerid] = 359;
			}
	  	    MovePlayerCCTV(playerid);

		}
	    if(leftright == KEY_LEFT)
	    {
	        if(keys == KEY_SPRINT)
			{
	 	    	CCTVDegree[playerid] = (CCTVDegree[playerid] + 2.0);
			}
			else
			{
			    CCTVDegree[playerid] = (CCTVDegree[playerid] + 0.5);
			}
			if(CCTVDegree[playerid] >= 360)
	  	    {
	  	        CCTVDegree[playerid] = 0;
			}
	        MovePlayerCCTV(playerid);

	    }
	    if(updown == KEY_UP)
	    {
	        if(CCTVRadius[playerid] < 25)
	        {
		        if(keys == KEY_SPRINT)
				{
				    CCTVRadius[playerid] =  (CCTVRadius[playerid] + 0.5);
		        	MovePlayerCCTV(playerid);
				}
				else
				{
				    CCTVRadius[playerid] =  (CCTVRadius[playerid] + 0.1);
		        	MovePlayerCCTV(playerid);
				}
			}
		}
		if(updown == KEY_DOWN)
	    {
			if(keys == KEY_SPRINT)
			{
			    if(CCTVRadius[playerid] >= 0.6)
	        	{
				    CCTVRadius[playerid] =  (CCTVRadius[playerid] - 0.5);
			       	MovePlayerCCTV(playerid);
				}
			}
			else
			{
			    if(CCTVRadius[playerid] >= 0.2)
	        	{
				    CCTVRadius[playerid] =  (CCTVRadius[playerid] - 0.1);
			       	MovePlayerCCTV(playerid);
				}
			}
		}
		if(keys == KEY_CROUCH)
		{
		    OnPlayerCommandReceived(playerid, "/camoff");
		}
	}
	MovePlayerCCTV(playerid);
}

stock MovePlayerCCTV(playerid)
{
	CCTVLA[playerid][0] = CCTVLAO[CurrentCCTV[playerid]][0] + (floatmul(CCTVRadius[playerid], floatsin(-CCTVDegree[playerid], degrees)));
	CCTVLA[playerid][1] = CCTVLAO[CurrentCCTV[playerid]][1] + (floatmul(CCTVRadius[playerid], floatcos(-CCTVDegree[playerid], degrees)));
	SetPlayerCameraLookAt(playerid, CCTVLA[playerid][0], CCTVLA[playerid][1], CCTVLA[playerid][2]);
}


stock AddCCTV(name[], Float:X, Float:Y, Float:Z, Float:Angle)
{
	if(TotalCCTVS >= MAX_CCTVS) return 0;
	format(CameraName[TotalCCTVS], 32, "%s", name);
	CCTVCP[TotalCCTVS][0] = X;
	CCTVCP[TotalCCTVS][1] = Y;
	CCTVCP[TotalCCTVS][2] = Z;
	CCTVCP[TotalCCTVS][3] = Angle;
	CCTVLAO[TotalCCTVS][0] = X;
	CCTVLAO[TotalCCTVS][1] = Y;
	CCTVLAO[TotalCCTVS][2] = Z-10;
	TotalCCTVS++;
	return TotalCCTVS-1;
}

SetPlayerToCCTVCamera(playerid, CCTV)
{
	if(CCTV >= TotalCCTVS)
	{
	    SendClientMessage(playerid, 0xFF0000AA, "Invald CCTV");
	    return 1;
	}
	if(CurrentCCTV[playerid] == -1)
    {
	    GetPlayerPos(playerid, LastPos[playerid][LX], LastPos[playerid][LY], LastPos[playerid][LZ]);
		GetPlayerFacingAngle(playerid, LastPos[playerid][LA]);
        LastPos[playerid][LInterior] = GetPlayerInterior(playerid);
	}
	else
	{
		KillTimer(KeyTimer[playerid]);
	}
	CurrentCCTV[playerid] = CCTV;
    TogglePlayerControllable(playerid, 0);
	//SetPlayerPos(playerid, CCTVCP[CCTV][0], CCTVCP[CCTV][1], (CCTVCP[CCTV][2]-50));
	SetPlayerPos(playerid, CCTVCP[CCTV][0], CCTVCP[CCTV][1], -100.0);
	SetPlayerCameraPos(playerid, CCTVCP[CCTV][0], CCTVCP[CCTV][1], CCTVCP[CCTV][2]);
	SetPlayerCameraLookAt(playerid, CCTVLAO[CCTV][0], (CCTVLAO[CCTV][1]+0.2), CCTVLAO[CCTV][2]);
	CCTVLA[playerid][0] = CCTVLAO[CCTV][0];
	CCTVLA[playerid][1] = CCTVLAO[CCTV][1]+0.2;
	CCTVLA[playerid][2] = CCTVLAO[CCTV][2];
	CCTVRadius[playerid] = 12.5;
	CCTVDegree[playerid] = CCTVCP[CCTV][3];
	MovePlayerCCTV(playerid);
    KeyTimer[playerid] = SetTimerEx("CheckKeyPress", 75, 1, "i", playerid);
    TextDrawShowForPlayer(playerid, TD);
	return 1;
}
//------------------------ EOS ----------------------------------

new Logged[MAX_PLAYERS];
new playerCheckpoint[MAX_PLAYERS];
// Chat games
new MathGameOn;
new answer;
//timers
new TwentyTimer;
new DopeTimer;


new DuelWepz[MAX_PLAYERS][2]; // Max of Two duel weapons [0] & [1]
new DuelTimeoutTime;
// Player Enum
enum PlayerData
{
	Registered, LoggedIn, Level, Muted, Caps, Jailed, JailTime, Frozen, FreezeTime, Kills,
	Deaths, hours, mins, secs, TotalTime, ConnectTime, MuteWarnings, Warnings, Spawned, TimesSpawned,
	God, GodCar, DoorsLocked, SpamCount, SpamTime, PingCount, PingTime, BotPing, pPing[PING_MAX_EXCEEDS], blip,
	blipS, pColour, SpecID, SpecType, bool:AllowedIn, FailLogin, Regular, SpawnColour, Bank,
	xAccount, Cookies, Developer, CarKey, Licence, Hidden, Temped, DuelFrom, DuelTo,
 	Float:DuelX, Float:DuelY, Float:DuelZ, Float:DuelAng, IsInDuel, InRestricted, RestrictedTimer, HoldingObject,
 	ObjectStatus, HObjID, HObjBone, Float: HObjXoff, Float: HObjYoff, Float: HObjZoff, Float: HObjXrot, Float: HObjYrot, Float: HObjZrot,
  	AutoFix, TeleMsg, MyTime, MyHour, FavSkin, PlayerDynCar, CustomMsgLeave[128]
};
new PlayerInfo[MAX_PLAYERS][PlayerData];
//gPositional Arrays
new gCount;
new gSlots_Left;

stock GetgSlotsLeft()
{
	gSlots_Left = MAX_gPOSITIONS - gCount;
	return gSlots_Left;
}

enum gPosData
{
	gFileID,
	gInterior,
	gWorld,
	gvAuth,
	gCPID,
	Float:gX,
	Float:gY,
	Float:gZ,
	Float:gAngle,
	Text3D:g3DLabel,
	gName[128]
};
new gPosInfo[MAX_gPOSITIONS][gPosData];

enum Params // Anti DeAMX
{
	c,
	l
}
// Server Control Enum
enum ServerData
{
	MaxPing, ReadPMs, ReadCmds, MaxAdminLevel, AdminOnlySkins, AdminSkin, AdminSkin2, NameKick,
	PartNameKick, AntiBot, AntiSpam, AntiSwear, NoCaps, Locked, Password[128], GiveWeap, GiveMoney, ConnectMessages,
	AdminCmdMsg, AutoLogin, MaxMuteWarnings, DisableChat, MustLogin, MustRegister
};
new ServerInfo[ServerData];

//include some stuff from other files

#include "lsx_inc/Zones.pwn"
#include "lsx_inc/ZoneFunc.pwn"


//Newbie Spawn
new Rule1, Rule2, Rule3, Rule4;
new Text3D:Rule1_3D;
new Text3D:Rule2_3D;
new Text3D:Rule3_3D;
new Text3D:Rule4_3D;
new Newb_Wep1, Newb_Wep2;

// Holding object n ting
new CurrentHoldingOb[MAX_PLAYERS];

//Jail
new JailHelp;
new JailTimer[MAX_PLAYERS];

// Minigame Variables
new pGame[MAX_PLAYERS];

// TextDraw Variables
new Text:test;
new Text:WebUrl;
new Text:LevelText[MAX_PLAYERS];
new Text:Clock;
//new Text:WeekDayg;
//---
new KillerID[MAX_PLAYERS] = INVALID_PLAYER_ID;
new Gamecar[MAX_PLAYERS] = INVALID_PLAYER_ID;
new PlayerTime[MAX_PLAYERS];
new AdminLoungeEnter, AdminLoungeExit, AdminRoofEnter, AdminRoofExit;
new aVehicle[18];
new VIPVehicle[9];
new InStadium[MAX_PLAYERS], StuntBike1, StuntBike2, StuntQuad1;
new VIPEnter, VIPExit, InVipRoom[MAX_PLAYERS];
//new IsPlayerInVipArea;
new LicenceCentre, LicenceExit;
new FcProtOn, FCgate1, Fcopen;
new WantedCar;
new WantedIconTimer;
new bankpickup, bankexit, InBank[MAX_PLAYERS], InBankCheckpoint[MAX_PLAYERS];
new JeromeOwns;
new IsSpawning[MAX_PLAYERS], AcActive, hackchecktimer, AdminGaveMeIt[MAX_PLAYERS]; // Subject to change
new AreaTimer;
new handofgod[MAX_PLAYERS];
new Speeder;
new IsAtTune[MAX_PLAYERS];
new Basejumper[MAX_PLAYERS], PlayerTaxi[MAX_PLAYERS];
new SlapMeHarder[MAX_PLAYERS], IsSuicidal[MAX_PLAYERS];
new AdminWorld[MAX_PLAYERS];
new iSpawnSet[MAX_PLAYERS], SpawnMenu, SpawnMenu2;
static stock iPlayerSpawnWeapon[MAX_PLAYERS][50];
new drunken[MAX_PLAYERS];
new Vallow[MAX_PLAYERS];
new bank[MAX_PLAYERS];
new TeleBan[MAX_PLAYERS];
new PauseTag[MAX_PLAYERS];
// B1
new b1AutoGate[3], b1AutoGateStatus[2]; // Status: [0] Exit gate [1] entry gate
new Menu:Revenge;
new ShipTimer;
new WantedTimer, WantedGameOn;
new afkdude[MAX_PLAYERS];
new Float:AfkPosi[MAX_PLAYERS][3];
new Float:TelePos[MAX_PLAYERS][6];
// Gang Variables
new gangMembers[MAX_GANGS][MAX_GANG_MEMBERS];
new gangNames[MAX_GANGS][MAX_GANG_NAME];
new gangInfo[MAX_GANGS][3]; //0-created,1-members,2-color
new gangBank[MAX_GANGS];
new playerGang[MAX_PLAYERS];
new gangInvite[MAX_PLAYERS];
new bounty[MAX_PLAYERS];
new IsInCheckPoint[MAX_PLAYERS];
//new IsInLoginRoom[MAX_PLAYERS];
new AdColor,RColor;
new fcinfo;
new uzi2;
new sawnoff2;
new shippickup;
new CashScoreOld;
new IsPlayerDed[MAX_PLAYERS];
new Float:AFKPos[MAX_PLAYERS][6];
new SecretHax1;
new Positionofdude[MAX_PLAYERS];
new VehicleStr[1000][32][Params];
new gActivePlayers[MAX_PLAYERS];
new gLastGaveCash[MAX_PLAYERS];
new SpawnArmourBought[MAX_PLAYERS];
new DynamicV[MAX_VEHICLES];
new NewbieSpawnDone[MAX_PLAYERS];
new vObject[MAX_PLAYERS];
// For the command anti-abuse timers etc. //

new PlayerTp[MAX_PLAYERS],PlayerCtp[MAX_PLAYERS],PlayerDive[MAX_PLAYERS],PlayerCardive[MAX_PLAYERS],PlayerGivecash[MAX_PLAYERS];
new Float:Pos[MAX_PLAYERS][4];
new LOL;
new Chat[MAX_CHAT_LINES][128];

//Timers
new PingTimer, GodTimer, RepairTimer, FreezeTimer[MAX_PLAYERS], LockKickTimer[MAX_PLAYERS];
new CountDown = -1, InDuel[MAX_PLAYERS], StatsTimer;

// Menus
#if defined USE_MENUS
new Menu:LMainMenu, Menu:AdminEnable, Menu:AdminDisable,
    Menu:LVehicles, Menu:twodoor, Menu:fourdoor, Menu:fastcar, Menu:Othercars,
	Menu:bikes, Menu:boats, Menu:planes, Menu:helicopters,
    Menu:XWeapons, Menu:XWeaponsBig, Menu:XWeaponsSmall, Menu:XWeaponsMore,
    Menu:LWeather,Menu:LTime,
    Menu:LTuneMenu, Menu:PaintMenu, Menu:LCars, Menu:LCars2,
    Menu:LTele, Menu:LasVenturasMenu, Menu:LosSantosMenu, Menu:SanFierroMenu,
	Menu:DesertMenu, Menu:FlintMenu, Menu:MountChiliadMenu,	Menu:InteriorsMenu;
#endif
// Spawn weapon menu
new Menu:weaponmenu;
new Menu:Grenades;
new Menu:sawnoff;
new Menu:combat;
new Menu:uzi;
new Menu:tec9;
new Menu:mp5;
new Menu:sniper;
new Menu:m4;
new Menu:ak47;
new Menu:deagle;

// Forbidden Names & Words
new BadNames[100][100], // Whole Names
    BadNameCount = 0,
	BadPartNames[100][100], // Part of name
    BadPartNameCount = 0,
    ForbiddenWords[100][100],
    ForbiddenWordCount = 0;

new Reports[MAX_REPORTS][128];
new PingPos;
//Arrays

new StolenCars[9][1] = {
	 {456},
	 {405},
	 {566},
	 {451},
	 {401},
	 {555},
	 {429},
	 {504},
	 {503}
};

new RandomSlaps[][] = {
	"baseball bat","hacksaw","mobile phone","laptop","5doler whore","ghetto blaster","slut",
	"minigun","ratchet","playstation controller","xbox360","PlayLSX T-Shirt","Christmas Tree",
	"Trebor mint","weed plant","flat-screen TV","penis","large purple dildo","goat"
};

new JustSlapped[MAX_PLAYERS];

#if CHRISTMAS_BUILD == 1
new Float:surprise[57][3] = // positions random pickups
{
	{1561.18, -1473.44, 13.54},
	{1711.64, -1573.40, 13.95},
	{1721.82, -1654.47, 20.96},
	{483.33, -1.53, 1002.07},
	{1941.45, -1776.51, 13.64},
	{1796.45, -1804.47, 5.01},
	{1929.98, -1890.31, 15.03},
	{1990.81, -2014.47, 13.05},
	{2027.33, -2093.44, 15.58},
	{2112.05, -1992.19, 13.25},
	{2371.75, -2135.15, 27.17},
	{2495.97, -2072.27, 13.06},
	{2643.94, -2093.90, 13.06},
	{2857.58, -2216.30, 0.91},
	{2786.19, -1423.48, 15.76},
	{2819.80, -1425.82, 39.57},
	{2847.90, -1302.34, 15.67},
	{2766.71, -1191.91, 69.40},
	{2750.32, -1202.13, 72.47},
	{2667.05, -1216.78, 68.43},
	{2435.88, -1321.18, 24.27},
	{2467.31, -1413.35, 23.26},
	{2298.07, -1412.35, 20.42},
	{2255.06, -1457.29, 24.00},
	{2065.38, -1394.48, 23.93},
	{1757.45, -1350.17, 15.60},
	{1677.29, -1460.22, 13.55},
	{1480.24, -1639.75, 14.14},
	{1497.68, -1665.28, 34.04},
	{1539.03, -1850.15, 13.54},
	{1421.27, -1849.18, 13.96},
	{1337.97, -1816.24, 13.54},
	{1117.56, -2037.22, 78.75},
	{953.77, -1823.73, 13.31},
	{870.80, -1835.30, 10.48},
	{830.62, -1890.74, 5.83},
	{673.99, -1867.22, 5.46},
	{498.50, -1874.76, 4.67},
	{528.27, -1815.19, 9.28},
	{386.86, -1831.41, 9.38},
	{406.26, -2066.01, 7.35},
	{285.79, -1619.21, 32.52},
	{291.43, -1503.46, 24.43},
	{422.49, -1299.33, 14.56},
	{441.70, -1357.09, 14.33},
	{136.03, -1501.29, 18.27},
	{-384.21, -1041.49, 58.37},
	{-393.90, -1148.77, 68.91},
	{-810.67, -1293.64, 79.40},
	{-1113.04, -1637.21, 75.87},
	{-1095.01, -1664.20, 76.36},
	{2158.90, -101.27, 2.75},
	{2252.02, 60.65, 29.48},
	{2324.90, 59.09, 26.48},
	{2321.96, -3.97, 26.48},
	{2323.97, -3.87, 26.55},
	{2560.04, 72.00, 26.47}
};
#endif

new Float:Positions[14][4] = {
	 {1584.2347,-1413.9352,13.2506,91.2892},
	 {2114.9949,-1260.7271,23.6608,89.2111},
	 {1977.2738,-1306.3676,20.4970,269.0471},
	 {1514.2577,-1459.9459,9.1709,92.8376},
	 {1110.9181,-1329.0066,12.9187,180.7758},
	 {1091.5121,-1206.9583,17.4756,90.1702},
	 {739.7209,-1350.1526,13.1749,89.0444},
	 {706.0012,-1681.6796,3.1088,359.7345},
	 {488.3990,-1506.8037,20.1507,5.0490},
	 {300.8019,-1490.8851,24.2647,53.8550},
	 {432.6529,-1752.4315,8.3450,181.9371},
	 {1016.2964,-1922.7776,12.1488,180.1366},
	 {1727.5305,-2286.8538,-3.0968,0.0055},
	 {1560.5028,-2241.1821,13.2182,89.4132}

};

new RandomColors[100] = {
0x29C4CCFF, 0xC715FFFF, 0x20B2AAFF, 0xDC143CFF, 0x6495EDFF, 0x00f68cFF, 0x778899FF, 0xFF1493FF, 0xF4A460FF, 0xEE82EEFF, // 0
0xA55043FF, 0x8b4513FF, 0x4949A0FF, 0x148b8bFF, 0x14ff7fFF, 0x556b2fFF, 0x0FD9FAFF, 0x10DC29FF, 0x534081FF, 0x0495CDFF, // 1
0xEF6CE8FF, 0xBD34DAFF, 0x247C1BFF, 0x0C8E5DFF, 0x635B03FF, 0xCB7ED3FF, 0x65ADEBFF, 0x5C1ACCFF, 0x00F853FF, 0x11F891FF, // 2
0x7B39AAFF, 0x53EB10FF, 0x54137DFF, 0x275222FF, 0xF09F5BFF, 0x3D0A4FFF, 0x22F767FF, 0xD63034FF, 0x9A6980FF, 0xDFB935FF, // 3
0xD8C762FF, 0x90239DFF, 0xE9AB2FFF, 0xAF2FF3FF, 0x057F94FF, 0xB98519FF, 0x388EEAFF, 0x028151FF, 0xA55043FF, 0x0DE018FF, // 4
0x93AB1CFF, 0x95BAF0FF, 0x369976FF, 0x18F71FFF, 0x4B8987FF, 0x491B9EFF, 0x829DC7FF, 0xBCE635FF, 0xCEA6DFFF, 0x20D4ADFF, // 5
0x005A99FF, 0x3C1C0DFF, 0x12D6D4FF, 0x48C000FF, 0x2A51E2FF, 0xE3AC12FF, 0xFC42A8FF, 0x2FC827FF, 0x1A30BFFF, 0xB740C2FF, // 6
0x42ACF5FF, 0x2FD9DEFF, 0xFAFB71FF, 0x05D1CDFF, 0xC471BDFF, 0x94436EFF, 0xC1F7ECFF, 0xCE79EEFF, 0xBD1EF2FF, 0x93B7E4FF, // 7
0x3214AAFF, 0x184D3BFF, 0xAE4B99FF, 0x7E49D7FF, 0x4C436EFF, 0xFA24CCFF, 0xCE76BEFF, 0xA04E0AFF, 0x9F945CFF, 0xDCDE3DFF, // 8
0x10C9C5FF, 0x70524DFF, 0x0BE472FF, 0x8A2CD7FF, 0x6152C2FF, 0xCF72A9FF, 0xE59338FF, 0xEEDC2DFF, 0xFF8C13FF, 0xFFFF00FF  // 9
};

new Float:AFKPosition[12][4] = {
	{1985.8073,1936.4894,124.5000,246.5428},
	{1982.6754,1931.4966,124.5000,235.2104},
	{1987.3257,1939.3085,124.5000,235.7054},
	{1992.0756,1947.4528,124.5000,237.4471},
	{1978.2830,1955.1852,124.5000,59.9341},
	{1975.6288,1950.5400,124.5000,61.4381},
	{1973.0049,1945.8209,124.5000,51.3985},
	{1968.9255,1939.0461,124.5000,54.4000},
	{1982.3307,1901.5377,124.5000,299.4514},
	{1986.6288,1894.4667,124.5000,300.9554},
	{1973.2881,1886.5360,124.5000,119.9922},
	{1969.3374,1892.8154,124.5000,114.4054}
};


#if CHRISTMAS_BUILD == 1
new NewsMsg[12][254] = {
   "LSX News: Type /commands to see the current available commands list.",
   "LSX News: Do NOT use any hack/cheat, you will end up banned!",
   "LSX News: Crew applications are currently open. See the forum for info.",
   "LSX News: English in mainchat, Use /pm [id] [text] for other languages.",
   "LSX News: Please don't use CAPS, you will be muted!",
   "LSX News: Remember to read and obey the /rules!",
   "LSX News: Try /crew to see the online admins.",
   "LSX News: Never report cheaters in main-chat! Use /report [ID] [Reason].",
   "LSX News: Join our IRC channels on irc.gtanet.com! #LSX_ and #LSX.echo",
   "LSX News: Reporting cheaters will earn you cookies, Earn 25 and get a cash prize!",
   "LSX News: Enter todays /lotto for a chance to win big cash prizes!",
   "LSX NEWS: It's Christmas, check out /christmas for season command help."
};
#else
new NewsMsg[11][254] = {
   "LSX News: Type /commands to see the current available commands list.",
   "LSX News: Do NOT use any hack/cheat, you will end up banned!",
   "LSX News: Crew applications are currently open. See the forum for info.",
   "LSX News: English in mainchat, Use /pm [id] [text] for other languages.",
   "LSX News: Please don't use CAPS, you will be muted!",
   "LSX News: Remember to read and obey the /rules!",
   "LSX News: Try /crew to see the online admins.",
   "LSX News: Never report cheaters in main-chat! Use /report [ID] [Reason].",
   "LSX News: Join our IRC channels on irc.gtanet.com! #LSX_ and #LSX.echo",
   "LSX News: Reporting cheaters will earn you cookies, Earn 25 and get a cash prize!",
   "LSX News: Enter todays /lotto for a chance to win big cash prizes!"
};
#endif

new weatherID[14][4] = {
	20,1,2,3,4,5,
	6,7,8,9,13,14
	,19,1337
};
// Custom public Forwards
forward MoneyGrubScoreUpdate();
forward Givecashdelaytimer(playerid);
forward SendPlayerFormattedText(playerid, const str[], define);
forward SetPlayerRandomSpawn(playerid);
forward SetupPlayerForClassSelection(playerid);
forward msgtimer();
//forward GetWeekdayNum(d,m,y);
forward settime(playerid);
forward AdminColorHax(playerid);
forward RandomColorsTimer(playerid);
forward PlayerTpCtpTimer(playerid);
forward PlayerDiveCardiveTimer(playerid);
forward PlayerGivecashTimer(playerid);
forward PlayerTaxiTimer(playerid);
forward AFKick(playerid);

new Float:gRandomPlayerSpawns[30][3] = {
{1094.4218,-1098.2269,25.2422},
{1101.2023,-1085.7203,26.1813},
{1096.1254,-1064.2736,29.1876},
{1103.8142,-1026.3247,32.0990},
{1142.7146,-1026.3687,32.0073},
{291.8222,-1336.9775,53.4404},
{246.7791,-1354.0120,53.1094},
{161.7426,-1342.1641,69.6395},
{419.9783,-1264.4738,51.5809},
{398.8884,-1270.2999,50.0198},
{2241.2683,-1241.4480,25.3971},
{2221.3689,-1237.8572,24.8427},
{2144.9207,-1245.7646,24.9917},
{2104.0166,-1245.5676,25.2678},
{2191.5950,-1277.3251,25.0362},
{2445.4460,-1760.0978,13.5893},
{2508.1235,-1957.5573,13.5979},
{2745.6157,-1944.7648,13.5469},
{2358.1067,-2154.6165,13.5750},
{2174.5754,-1985.0876,13.5508},
{2280.0186,-1693.8652,13.6150},
{1107.1555,-1181.4159,18.6246},
{1140.0044,-1269.2050,21.5469},
{1108.3196,-1489.7266,22.7690},
{1371.2915,-1505.9226,13.5469},
{1410.1135,-1307.9274,9.4156},
{759.2768,-1507.9548,13.5495},
{695.1151,-1705.6946,3.5997},
{391.8723,-2058.6064,10.7212},
{-26.4364,2348.8064,24.1347}
};

new VehicleNames[212][] = {
	"Landstalker","Bravura","Buffalo","Linerunner","Pereniel","Sentinel","Dumper","Firetruck","Trashmaster","Stretch","Manana","Infernus",
	"Voodoo","Pony","Mule","Cheetah","Ambulance","Leviathan","Moonbeam","Esperanto","Taxi","Washington","Bobcat","Mr Whoopee","BF Injection",
	"Hunter","Premier","Enforcer","Securicar","Banshee","Predator","Bus","Rhino","Barracks","Hotknife","Trailer","Previon","Coach","Cabbie",
	"Stallion","Rumpo","RC Bandit","Romero","Packer","Monster","Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Trailer","Turismo","Speeder",
	"Reefer","Tropic","Flatbed","Yankee","Caddy","Solair","Berkley's RC Van","Skimmer","PCJ-600","Faggio","Freeway","RC Baron","RC Raider",
	"Glendale","Oceanic","Sanchez","Sparrow","Patriot","Quad","Coastguard","Dinghy","Hermes","Sabre","Rustler","ZR3 50","Walton","Regina",
	"Comet","BMX","Burrito","Camper","Marquis","Baggage","Dozer","Maverick","News Chopper","Rancher","FBI Rancher","Virgo","Greenwood",
	"Jetmax","Hotring","Sandking","Blista Compact","Police Maverick","Boxville","Benson","Mesa","RC Goblin","Hotring Racer A","Hotring Racer B",
	"Bloodring Banger","Rancher","Super GT","Elegant","Journey","Bike","Mountain Bike","Beagle","Cropdust","Stunt","Tanker","RoadTrain",
	"Nebula","Majestic","Buccaneer","Shamal","Hydra","FCR-900","NRG-500","HPV1000","Cement Truck","Tow Truck","Fortune","Cadrona","FBI Truck",
	"Willard","Forklift","Tractor","Combine","Feltzer","Remington","Slamvan","Blade","Freight","Streak","Vortex","Vincent","Bullet","Clover",
	"Sadler","Firetruck","Hustler","Intruder","Primo","Cargobob","Tampa","Sunrise","Merit","Utility","Nevada","Yosemite","Windsor","Monster A",
	"Monster B","Uranus","Jester","Sultan","Stratum","Elegy","Raindance","RC Tiger","Flash","Tahoma","Savanna","Bandito","Freight","Trailer",
	"Kart","Mower","Duneride","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley","Stafford","BF-400","Newsvan","Tug","Trailer A","Emperor",
	"Wayfarer","Euros","Hotdog","Club","Trailer B","Trailer C","Andromada","Dodo","RC Cam","Launch","Police Car (LSPD)","Police Car (SFPD)",
	"Police Car (LVPD)","Police Ranger","Picador","S.W.A.T. Van","Alpha","Phoenix","Glendale","Sadler","Luggage Trailer A","Luggage Trailer B",
	"Stair Trailer","Boxville","Farm Plow","Utility Trailer"
};

new TAXI_AMOUNT = 5000; // Amount, adjustable
//new PPKM = 500; // not implemented
new Float: TaxiAmmu[10][4] = {
	{2398.3394,-1979.4537,13.5469,359.1982}, // Ammu near docks
	{1365.5138,-1283.2202,13.5469,87.8066}, // Ammu main LS
	{-2094.6914,-2461.9651,30.6250,326.2789}, // Ammu Angel Pine
	{-2631.0215,210.7834,4.4849,5.5396}, // Ammu SF
	{-313.6784,832.0026,14.2422,90.7904}, // Outskirts AMmu
	{779.3189,1875.1564,4.9304,269.7054}, // Outskirts innerskirt o_O
	{2536.1736,2081.3608,10.8203,93.3439}, // LVP ammu
	{2156.2607,940.8405,10.8203,88.9805}, // Ammu LVP other one
	{2333.7671,65.1486,27.4693,271.3656}, // Palimino creek
	{238.8294,-180.3767,1.5781,266.6656} // DillimorE? who knows ..
};

//==============================================================================

main()
{
	print("\n------------------------------------");
	print("       Los Santos Xtreme        ");
	print("------------------------------------\n");
}

public MoneyGrubScoreUpdate() // Fixed, some nerd forgot the timer.
{                             // Player cash = Score. Better than kills, k.
	new CashScore;
	new name[MAX_PLAYER_NAME];
	for(new i=0; i<MAX_PLAYERS; i++)
	{
		if (IsPlayerConnected(i))
		{
			GetPlayerName(i, name, sizeof(name));
   			CashScore = GetPlayerMoney(i);
			SetPlayerScore(i, CashScore);
			if (CashScore > CashScoreOld)
			{
				CashScoreOld = CashScore;
			}
		}
	}
}

// ---------------------------- LSX OnGameModeInit ---------------------------//

#define VIEW_OBJECT 200
public OnGameModeInit()
{
    Audio_SetPack("lsx_pack", true);
	print("\n________________________________________");
	print("________________________________________");
	print("       Los Santos Xtreme Loading...     ");
	print("________________________________________");

	if(!fexist("lsx/"))
	{
	    print("\n\n > WARNING: Folder Missing From Scriptfiles\n");
	  	SetTimerEx("PrintWarning",2500,0,"s","lsx");
		return 1;
	}
	if(!fexist("lsx/logs/"))
	{
	    print("\n\n > WARNING: Folder Missing From Scriptfiles\n");
	  	SetTimerEx("PrintWarning",2500,0,"s","lsx/logs");
		return 1;
	}
	if(!fexist("lsx/config/"))
	{
	    print("\n\n > WARNING: Folder Missing From Scriptfiles\n");
	  	SetTimerEx("PrintWarning",2500,0,"s","lsx/config");
		return 1;
	}
	if(!fexist("lsx/users/"))
	{
	    print("\n\n > WARNING: Folder Missing From Scriptfiles\n");
	  	SetTimerEx("PrintWarning",2500,0,"s","lsx/users");
		return 1;
	}
	AntiDeAMX(); // anti-decompile initiating
	UpdateConfig();
	#if defined DISPLAY_CONFIG
	ConfigInConsole();
	#endif
	MathGameOn = 0;
	SetTimer("MathOn",300000,false);

	// Load gPositions
	LoadgPosData();
	// load export
	Export_CP = CreateDynamicCP(2410.4888,-2272.0916,13.6962, 3.0, -1, -1, -1, 150);
	CExport__NewWantedVehicle();

	// Christmas stuff
	#if CHRISTMAS_BUILD == 1
	giftPickup = -1;
	giftRunning = 0;
	giftID = -1;
	#endif

	#if IRC_ENABLED == 1
	// Wait 5 seconds for the first bot
	SetTimerEx("IRC_ConnectDelay", 5000, 0, "d", 1);
	// Wait 10 seconds for the second bot
	SetTimerEx("IRC_ConnectDelay", 10000, 0, "d", 2);
	// Create a group (the bots will be added to it upon connect)
	gGroupID = IRC_CreateGroup();
	#endif

	//================== Connecting the NPC's ======================//
    #if CONNECT_BOTS == 1
	ConnectNPC("PoliceChopper","PoliceHeli");
	ConnectNPC("Black_Ops_1", "BlackOpsHeli1");
	ConnectNPC("The_Watcher", "BlackOpsRancher");

	BlackOpsHeli_1 = CreateVehicle(487, 0.0, 0.0, 5.0, 0.0, 0, 0, 5000);
	BlackOpsRancher = CreateVehicle(490, 0.0, 0.0, 5.0, 0.0, 0, 0, 5000);
	NPCPoliceHeli = CreateVehicle(497, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
	#endif
	//==================== Object Loading... ==========================//
	#if INIT_MAP_BDESERT == 1
	#include "lsx_inc/objects/bdesert.pwn"
	#endif
	#if INIT_MAP_MYLAND == 1
	#include "lsx_inc/objects/myland.pwn"
	#endif
	// Experimental Maps
	#include "lsx_inc/objects/deathball.pwn"
	#include "lsx_inc/objects/city1.pwn"
	#include "lsx_inc/objects/paradise.pwn"
	
	
	//==============================================================//
	//===================== [ The Menus ]===========================//
	Revenge = CreateMenu("Revenge Menu", 2, 160.0, 150.0, 100.0, 50.0);
    //SetMenuColumnHeader(RevengeIsSweet, 0, "Lame Kill Punishment");
    AddMenuItem(Revenge, 0, "Steal Money");
    AddMenuItem(Revenge, 0, "Send To Jail");
    AddMenuItem(Revenge, 0, "Maim by Flame");
    AddMenuItem(Revenge, 0, "Remove Weapons");
    AddMenuItem(Revenge, 0, "Own");

    weaponmenu = CreateMenu("Select Weapon", 2, 20.0, 160.0, 100.0, 150.0);
	AddMenuItem(weaponmenu, 0, "Grenades");
	AddMenuItem(weaponmenu, 0, "Sawnoff Shotgun");
	AddMenuItem(weaponmenu, 0, "Combat Shotgun");
	AddMenuItem(weaponmenu, 0, "Micro Uzi");
	AddMenuItem(weaponmenu, 0, "Tec9");
	AddMenuItem(weaponmenu, 0, "Mp5");
	AddMenuItem(weaponmenu, 0, "Sniper Rifle");
	AddMenuItem(weaponmenu, 0, "Parachute");
	AddMenuItem(weaponmenu, 0, "M4");
	AddMenuItem(weaponmenu, 0, "AK-47");
	AddMenuItem(weaponmenu, 0, "Desert Eagle");
	AddMenuItem(weaponmenu, 0, "Spawn Armour");

	Grenades = CreateMenu("Amount", 2, 20.0, 160.0, 100.0, 150.0);
	AddMenuItem(Grenades, 0, "1x   $15,000");
	AddMenuItem(Grenades, 0, "2x   $30,000");
	AddMenuItem(Grenades, 0, "5x   $75,000");
	AddMenuItem(Grenades, 0, "10x  $100,000");
	AddMenuItem(Grenades, 0, "20x  $300,000");
	AddMenuItem(Grenades, 0, "50x  $750,000");
	AddMenuItem(Grenades, 0, "100x $1,000,000");
	AddMenuItem(Grenades, 0, "150x $1,500,000");

	sawnoff = CreateMenu("Ammount", 2, 20.0, 160.0, 100.0, 150.0);
	AddMenuItem(sawnoff, 0, "1x   $15,000");
	AddMenuItem(sawnoff, 0, "2x   $30,000");
	AddMenuItem(sawnoff, 0, "5x   $75,000");
	AddMenuItem(sawnoff, 0, "10x  $100,000");
	AddMenuItem(sawnoff, 0, "20x  $300,000");
	AddMenuItem(sawnoff, 0, "50x  $750,000");
	AddMenuItem(sawnoff, 0, "100x $1,000,000");
	AddMenuItem(sawnoff, 0, "150x $1,500,000");

	combat = CreateMenu("Amount", 2, 20.0, 160.0, 100.0, 150.0);
	AddMenuItem(combat, 0, "1x   $15,000");
	AddMenuItem(combat, 0, "2x   $30,000");
	AddMenuItem(combat, 0, "5x   $75,000");
	AddMenuItem(combat, 0, "10x  $100,000");
	AddMenuItem(combat, 0, "20x  $300,000");
	AddMenuItem(combat, 0, "50x  $750,000");
	AddMenuItem(combat, 0, "100x $1,000,000");
	AddMenuItem(combat, 0, "150x $1,500,000");

	uzi = CreateMenu("Amount", 2, 20.0, 160.0, 100.0, 150.0);
	AddMenuItem(uzi, 0, "1x   $15,000");
	AddMenuItem(uzi, 0, "2x   $30,000");
	AddMenuItem(uzi, 0, "5x   $75,000");
	AddMenuItem(uzi, 0, "10x  $100,000");
	AddMenuItem(uzi, 0, "20x  $300,000");
	AddMenuItem(uzi, 0, "50x  $750,000");
	AddMenuItem(uzi, 0, "100x $1,000,000");
	AddMenuItem(uzi, 0, "150x £1,500,000");

	tec9 = CreateMenu("Amount", 2, 20.0, 160.0, 100.0, 150.0);
	AddMenuItem(tec9, 0, "1x   $15,000");
	AddMenuItem(tec9, 0, "2x   $30,000");
	AddMenuItem(tec9, 0, "5x   $75,000");
	AddMenuItem(tec9, 0, "10x  $100,000");
	AddMenuItem(tec9, 0, "20x  $300,000");
	AddMenuItem(tec9, 0, "50x  $750,000");
	AddMenuItem(tec9, 0, "100x $1,000,000");
	AddMenuItem(tec9, 0, "150x $1,500,000");

	mp5 = CreateMenu("Amount", 2, 20.0, 160.0, 100.0, 150.0);
	AddMenuItem(mp5, 0, "1x   $15,000");
	AddMenuItem(mp5, 0, "2x   $30,000");
	AddMenuItem(mp5, 0, "5x   $75,000");
	AddMenuItem(mp5, 0, "10x  $100,000");
	AddMenuItem(mp5, 0, "20x  $300,000");
	AddMenuItem(mp5, 0, "50x  $750,000");
	AddMenuItem(mp5, 0, "100x $1,000,000");
	AddMenuItem(mp5, 0, "150x $1,500,000");

	sniper = CreateMenu("Amount", 2, 20.0, 160.0, 100.0, 150.0);
	AddMenuItem(sniper, 0, "1x   $15,000");
	AddMenuItem(sniper, 0, "2x   $30,000");
	AddMenuItem(sniper, 0, "5x   $75,000");
	AddMenuItem(sniper, 0, "10x  $100,000");
	AddMenuItem(sniper, 0, "20x  $300,000");
	AddMenuItem(sniper, 0, "50x  $750,000");
	AddMenuItem(sniper, 0, "100x $1,000,000");
	AddMenuItem(sniper, 0, "150x $1,500,000");

	m4 = CreateMenu("Amount", 2, 20.0, 160.0, 100.0, 150.0);
	AddMenuItem(m4, 0, "1x   $15,000");
	AddMenuItem(m4, 0, "2x   $30,000");
	AddMenuItem(m4, 0, "5x   $75,000");
	AddMenuItem(m4, 0, "10x  $100,000");
	AddMenuItem(m4, 0, "20x  $300,000");
	AddMenuItem(m4, 0, "50x  $750,000");
	AddMenuItem(m4, 0, "100x $1,000,000");
	AddMenuItem(m4, 0, "150x $1,500,000");

	ak47 = CreateMenu("Amount", 2, 20.0, 160.0, 100.0, 150.0);
	AddMenuItem(ak47, 0, "1x   $15,000");
	AddMenuItem(ak47, 0, "2x   $30,000");
	AddMenuItem(ak47, 0, "5x   $75,000");
	AddMenuItem(ak47, 0, "10x  $100,000");
	AddMenuItem(ak47, 0, "20x  $300,000");
	AddMenuItem(ak47, 0, "50x  $750,000");
	AddMenuItem(ak47, 0, "100x $1,000,000");
	AddMenuItem(ak47, 0, "150x $1,500,000");

	deagle = CreateMenu("Amount", 2, 20.0, 160.0, 100.0, 150.0);
	AddMenuItem(deagle, 0, "1x   $15,000");
	AddMenuItem(deagle, 0, "2x   $30,000");
	AddMenuItem(deagle, 0, "5x   $75,000");
	AddMenuItem(deagle, 0, "10x  $100,000");
	AddMenuItem(deagle, 0, "20x  $300,000");
	AddMenuItem(deagle, 0, "50x  $750,000");
	AddMenuItem(deagle, 0, "100x $1,000,000");
	AddMenuItem(deagle, 0, "150x $1,500,000");

	#if defined USE_MENUS

	LMainMenu = CreateMenu("Main Menu", 2,  55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(LMainMenu, 0, "Choose an option below");
	AddMenuItem(LMainMenu, 0, "Enable");
	AddMenuItem(LMainMenu, 0, "Disable");
    AddMenuItem(LMainMenu, 0, "Server Weather");
    AddMenuItem(LMainMenu, 0, "Server Time");
 	AddMenuItem(LMainMenu, 0, "All Vehicles");
	AddMenuItem(LMainMenu, 0, "Admin Cars");
	AddMenuItem(LMainMenu, 0, "Tuning Menu");
	AddMenuItem(LMainMenu, 0, "Choose Weapon");
	AddMenuItem(LMainMenu, 0, "Teleports");
	AddMenuItem(LMainMenu, 0, "Exit Menu");//

	AdminEnable = CreateMenu("~b~Configuration ~g~ Menu",2, 55.0, 200.0, 150.0, 80.0);
	SetMenuColumnHeader(AdminEnable, 0, "Enable");
	AddMenuItem(AdminEnable, 0, "Anti Swear");
	AddMenuItem(AdminEnable, 0, "Bad Name Kick");
	AddMenuItem(AdminEnable, 0, "Anti Spam");
	AddMenuItem(AdminEnable, 0, "Ping Kick");
	AddMenuItem(AdminEnable, 0, "Read Cmds");
	AddMenuItem(AdminEnable, 0, "Read PMs");
	AddMenuItem(AdminEnable, 0, "Capital Letters");
	AddMenuItem(AdminEnable, 0, "ConnectMessages");
	AddMenuItem(AdminEnable, 0, "AdminCmdMessages");
	AddMenuItem(AdminEnable, 0, "Auto Login");
	AddMenuItem(AdminEnable, 0, "Return");

	AdminDisable = CreateMenu("~b~Configuration ~g~ Menu",2, 55.0, 200.0, 150.0, 80.0);
	SetMenuColumnHeader(AdminDisable, 0, "Disable");
	AddMenuItem(AdminDisable, 0, "Anti Swear");
	AddMenuItem(AdminDisable, 0, "Bad Name Kick");
	AddMenuItem(AdminDisable, 0, "Anti Spam");
	AddMenuItem(AdminDisable, 0, "Ping Kick");
	AddMenuItem(AdminDisable, 0, "Read Cmds");
	AddMenuItem(AdminDisable, 0, "Read PMs");
	AddMenuItem(AdminDisable, 0, "Capital Letters");
	AddMenuItem(AdminDisable, 0, "ConnectMessages");
	AddMenuItem(AdminDisable, 0, "AdminCmdMessages");
	AddMenuItem(AdminDisable, 0, "Auto Login");
	AddMenuItem(AdminDisable, 0, "Return");

	LWeather = CreateMenu("~b~Weather ~g~ Menu",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(LWeather, 0, "Set Weather");
	AddMenuItem(LWeather, 0, "Clear Blue Sky");
	AddMenuItem(LWeather, 0, "Sand Storm");
	AddMenuItem(LWeather, 0, "Thunderstorm");
	AddMenuItem(LWeather, 0, "Foggy");
	AddMenuItem(LWeather, 0, "Cloudy");
	AddMenuItem(LWeather, 0, "High Tide");
	AddMenuItem(LWeather, 0, "Purple Sky");
	AddMenuItem(LWeather, 0, "Black/White Sky");
	AddMenuItem(LWeather, 0, "Dark, Green Sky");
	AddMenuItem(LWeather, 0, "Heatwave");
	AddMenuItem(LWeather,0,"Return");

	LTime = CreateMenu("~b~Time ~g~ Menu", 2,  55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(LTime, 0, "Set Time");
	AddMenuItem(LTime, 0, "Morning");
	AddMenuItem(LTime, 0, "Mid day");
	AddMenuItem(LTime, 0, "Afternoon");
	AddMenuItem(LTime, 0, "Evening");
	AddMenuItem(LTime, 0, "Midnight");
    AddMenuItem(LTime, 0, "Return");

	LCars = CreateMenu("~b~LSX ~g~Cars", 2,  55.0, 150.0, 100.0, 80.0);
	SetMenuColumnHeader(LCars, 0, "Choose a car");
	AddMenuItem(LCars, 0, "Turismo");
	AddMenuItem(LCars, 0, "Bandito");
	AddMenuItem(LCars, 0, "Vortex");
	AddMenuItem(LCars, 0, "NRG");
	AddMenuItem(LCars, 0, "S.W.A.T");
    AddMenuItem(LCars, 0, "Hunter");
    AddMenuItem(LCars, 0, "Jetmax (boat)");
    AddMenuItem(LCars, 0, "Rhino");
    AddMenuItem(LCars, 0, "Monster Truck");
    AddMenuItem(LCars, 0, "Sea Sparrow");
    AddMenuItem(LCars, 0, "More");
	AddMenuItem(LCars, 0, "Return");

	LCars2 = CreateMenu("~b~LethaL ~g~Cars", 2,  55.0, 150.0, 100.0, 80.0);
	SetMenuColumnHeader(LCars2, 0, "Choose a car");
	AddMenuItem(LCars2, 0, "Dumper");
    AddMenuItem(LCars2, 0, "RC Tank");
    AddMenuItem(LCars2, 0, "RC Bandit");
    AddMenuItem(LCars2, 0, "RC Baron");
    AddMenuItem(LCars2, 0, "RC Goblin");
    AddMenuItem(LCars2, 0, "RC Raider");
    AddMenuItem(LCars2, 0, "RC Cam");
    AddMenuItem(LCars2, 0, "Tram");
	AddMenuItem(LCars2, 0, "Return");

	LTuneMenu = CreateMenu("~b~Tuning ~g~ Menu",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(LTuneMenu, 0, "Add to car");
	AddMenuItem(LTuneMenu,0,"NOS");
	AddMenuItem(LTuneMenu,0,"Hydraulics");
	AddMenuItem(LTuneMenu,0,"Wire Wheels");
	AddMenuItem(LTuneMenu,0,"Twist Wheels");
	AddMenuItem(LTuneMenu,0,"Access Wheels");
	AddMenuItem(LTuneMenu,0,"Mega Wheels");
	AddMenuItem(LTuneMenu,0,"Import Wheels");
	AddMenuItem(LTuneMenu,0,"Atomic Wheels");
	AddMenuItem(LTuneMenu,0,"Offroad Wheels");
	AddMenuItem(LTuneMenu,0,"Classic Wheels");
	AddMenuItem(LTuneMenu,0,"Paint Jobs");
	AddMenuItem(LTuneMenu,0,"Return");

	PaintMenu = CreateMenu("~b~Paint Job ~g~ Menu",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(PaintMenu, 0, "Choose paint");
	AddMenuItem(PaintMenu,0,"Paint Job 1");
	AddMenuItem(PaintMenu,0,"Paint Job 2");
	AddMenuItem(PaintMenu,0,"Paint Job 3");
	AddMenuItem(PaintMenu,0,"Paint Job 4");
	AddMenuItem(PaintMenu,0,"Paint Job 5");
	AddMenuItem(PaintMenu,0,"Black");
	AddMenuItem(PaintMenu,0,"White");
	AddMenuItem(PaintMenu,0,"Blue");
	AddMenuItem(PaintMenu,0,"Pink");
	AddMenuItem(PaintMenu,0,"Return");

	LVehicles = CreateMenu("~b~Vehicles ~g~ Menu",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(LVehicles, 0, "Choose a car");
	AddMenuItem(LVehicles,0,"2-door Cars");
	AddMenuItem(LVehicles,0,"4-door Cars");
	AddMenuItem(LVehicles,0,"Fast Cars");
	AddMenuItem(LVehicles,0,"Other Vehicles");
	AddMenuItem(LVehicles,0,"Bikes");
	AddMenuItem(LVehicles,0,"Boats");
	AddMenuItem(LVehicles,0,"Planes");
	AddMenuItem(LVehicles,0,"Helicopters");
	AddMenuItem(LVehicles,0,"Return");

 	twodoor = CreateMenu("~b~2-door Cars",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(twodoor, 0, "Choose a car");
	AddMenuItem(twodoor,0,"Feltzer");//533
	AddMenuItem(twodoor,0,"Stallion");//139
	AddMenuItem(twodoor,0,"Windsor");//555
	AddMenuItem(twodoor,0,"Bobcat");//422
	AddMenuItem(twodoor,0,"Yosemite");//554
	AddMenuItem(twodoor,0,"Broadway");//575
	AddMenuItem(twodoor,0,"Blade");//536
	AddMenuItem(twodoor,0,"Slamvan");//535
	AddMenuItem(twodoor,0,"Tornado");//576
	AddMenuItem(twodoor,0,"Bravura");//401
	AddMenuItem(twodoor,0,"Fortune");//526
	AddMenuItem(twodoor,0,"Return");

 	fourdoor = CreateMenu("~b~4-door Cars",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(fourdoor, 0, "Choose a car");
	AddMenuItem(fourdoor,0,"Perenniel");//404
	AddMenuItem(fourdoor,0,"Tahoma");//566
	AddMenuItem(fourdoor,0,"Voodoo");//412
	AddMenuItem(fourdoor,0,"Admiral");//445
	AddMenuItem(fourdoor,0,"Elegant");//507
	AddMenuItem(fourdoor,0,"Glendale");//466
	AddMenuItem(fourdoor,0,"Intruder");//546
	AddMenuItem(fourdoor,0,"Merit");//551
	AddMenuItem(fourdoor,0,"Oceanic");//467
	AddMenuItem(fourdoor,0,"Premier");//426
	AddMenuItem(fourdoor,0,"Sentinel");//405
	AddMenuItem(fourdoor,0,"Return");

 	fastcar = CreateMenu("~b~Fast Cars",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(fastcar, 0, "Choose a car");
	AddMenuItem(fastcar,0,"Comet");//480
	AddMenuItem(fastcar,0,"Buffalo");//402
	AddMenuItem(fastcar,0,"Cheetah");//415
	AddMenuItem(fastcar,0,"Euros");//587
	AddMenuItem(fastcar,0,"Hotring Racer");//494
	AddMenuItem(fastcar,0,"Infernus");//411
	AddMenuItem(fastcar,0,"Phoenix");//603
	AddMenuItem(fastcar,0,"Super GT");//506
	AddMenuItem(fastcar,0,"Turismo");//451
	AddMenuItem(fastcar,0,"ZR-350");//477
	AddMenuItem(fastcar,0,"Bullet");//541
	AddMenuItem(fastcar,0,"Return");

 	Othercars = CreateMenu("~b~Other Vehicles",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(Othercars, 0, "Choose a car?");
	AddMenuItem(Othercars,0,"Monster Truck");//556
	AddMenuItem(Othercars,0,"Trashmaster");//408
	AddMenuItem(Othercars,0,"Bus");//431
	AddMenuItem(Othercars,0,"Coach");//437
	AddMenuItem(Othercars,0,"Enforcer");//427
	AddMenuItem(Othercars,0,"Rhino (Tank)");//432
	AddMenuItem(Othercars,0,"S.W.A.T.Truck");//601
	AddMenuItem(Othercars,0,"Cement Truck");//524
	AddMenuItem(Othercars,0,"Flatbed");//455
	AddMenuItem(Othercars,0,"BF Injection");//424
	AddMenuItem(Othercars,0,"Dune");//573
	AddMenuItem(Othercars,0,"Return");

 	bikes = CreateMenu("~b~Bikes",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(bikes, 0, "Choose a bike");
	AddMenuItem(bikes,0,"BF-400");
	AddMenuItem(bikes,0,"BMX");
	AddMenuItem(bikes,0,"Faggio");
	AddMenuItem(bikes,0,"FCR-900");
	AddMenuItem(bikes,0,"Freeway");
	AddMenuItem(bikes,0,"NRG-500");
	AddMenuItem(bikes,0,"PCJ-600");
	AddMenuItem(bikes,0,"Pizzaboy");
	AddMenuItem(bikes,0,"Quad");
	AddMenuItem(bikes,0,"Sanchez");
	AddMenuItem(bikes,0,"Wayfarer");
	AddMenuItem(bikes,0,"Return");

 	boats = CreateMenu("~b~Boats",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(boats, 0, "Choose a boat");
	AddMenuItem(boats,0,"Coastguard");//472
	AddMenuItem(boats,0,"Dingy");//473
	AddMenuItem(boats,0,"Jetmax");//493
	AddMenuItem(boats,0,"Launch");//595
	AddMenuItem(boats,0,"Marquis");//484
	AddMenuItem(boats,0,"Predator");//430
	AddMenuItem(boats,0,"Reefer");//453
	AddMenuItem(boats,0,"Speeder");//452
	AddMenuItem(boats,0,"Squallo");//446
	AddMenuItem(boats,0,"Tropic");//454
	AddMenuItem(boats,0,"Return");

 	planes = CreateMenu("~b~Planes",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(planes, 0, "Choose a plane");
	AddMenuItem(planes,0,"Andromada");//592
	AddMenuItem(planes,0,"AT400");//577
	AddMenuItem(planes,0,"Beagle");//511
	AddMenuItem(planes,0,"Cropduster");//512
	AddMenuItem(planes,0,"Dodo");//593
	AddMenuItem(planes,0,"Hydra");//520
	AddMenuItem(planes,0,"Nevada");//553
	AddMenuItem(planes,0,"Rustler");//476
	AddMenuItem(planes,0,"Shamal");//519
	AddMenuItem(planes,0,"Skimmer");//460
	AddMenuItem(planes,0,"Stuntplane");//513
	AddMenuItem(planes,0,"Return");

	helicopters = CreateMenu("~b~Helicopters",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(helicopters, 0, "Choose a helicopter");
	AddMenuItem(helicopters,0,"Cargobob");//
	AddMenuItem(helicopters,0,"Hunter");//
	AddMenuItem(helicopters,0,"Leviathan");//
	AddMenuItem(helicopters,0,"Maverick");//
	AddMenuItem(helicopters,0,"News Chopper");//
	AddMenuItem(helicopters,0,"Police Maverick");//
	AddMenuItem(helicopters,0,"Raindance");//
	AddMenuItem(helicopters,0,"Seasparrow");//
	AddMenuItem(helicopters,0,"Sparrow");//
	AddMenuItem(helicopters,0,"Return");

 	XWeapons = CreateMenu("~b~Weapons ~g~Main Menu",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(XWeapons, 0, "Choose a weapon");
	AddMenuItem(XWeapons,0,"Desert Eagle");//0
	AddMenuItem(XWeapons,0,"M4");
	AddMenuItem(XWeapons,0,"Sawnoff Shotgun");
	AddMenuItem(XWeapons,0,"Combat Shotgun");
	AddMenuItem(XWeapons,0,"UZI");
	AddMenuItem(XWeapons,0,"Rocket Launcher");
	AddMenuItem(XWeapons,0,"Minigun");//6
	AddMenuItem(XWeapons,0,"Sniper Rifle");
	AddMenuItem(XWeapons,0,"Big Weapons");
	AddMenuItem(XWeapons,0,"Small Weapons");//9
	AddMenuItem(XWeapons,0,"More");
	AddMenuItem(XWeapons,0,"Return");//11

 	XWeaponsBig = CreateMenu("~b~Weapons ~g~Big Weapons",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(XWeaponsBig, 0, "Choose a weapon");
	AddMenuItem(XWeaponsBig,0,"Shotgun");
	AddMenuItem(XWeaponsBig,0,"AK-47");
	AddMenuItem(XWeaponsBig,0,"Country Rifle");
	AddMenuItem(XWeaponsBig,0,"HS Rocket Launcher");
	AddMenuItem(XWeaponsBig,0,"Flamethrower");
	AddMenuItem(XWeaponsBig,0,"SMG");
	AddMenuItem(XWeaponsBig,0,"TEC9");
	AddMenuItem(XWeaponsBig,0,"Return");

 	XWeaponsSmall = CreateMenu("~b~Weapons ~g~Small Weapons",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(XWeaponsBig, 0, "Choose a weapon");
	AddMenuItem(XWeaponsSmall,0,"9mm");
	AddMenuItem(XWeaponsSmall,0,"Silenced 9mm");
	AddMenuItem(XWeaponsSmall,0,"Molotov Cocktail");
	AddMenuItem(XWeaponsSmall,0,"Fire Extinguisher");
	AddMenuItem(XWeaponsSmall,0,"Spraycan");
	AddMenuItem(XWeaponsSmall,0,"Frag Grenades");
	AddMenuItem(XWeaponsSmall,0,"Katana");
	AddMenuItem(XWeaponsSmall,0,"Chainsaw");
	AddMenuItem(XWeaponsSmall,0,"Return");

 	XWeaponsMore = CreateMenu("~b~Weapons ~g~More Weapons",2, 55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(XWeaponsBig, 0, "Choose a weapon");
	AddMenuItem(XWeaponsMore,0,"Jetpack");
	AddMenuItem(XWeaponsMore,0,"Knife");
	AddMenuItem(XWeaponsMore,0,"Flowers");
	AddMenuItem(XWeaponsMore,0,"Camera");
	AddMenuItem(XWeaponsMore,0,"Pool Cue");
	AddMenuItem(XWeaponsMore,0,"Baseball Bat");
	AddMenuItem(XWeaponsMore,0,"Golf Club");
	AddMenuItem(XWeaponsMore,0,"MAX AMMO");
	AddMenuItem(XWeaponsMore,0,"Return");

	LTele = CreateMenu("Teleports", 2,  55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(LTele, 0, "Admin Teleport");
	AddMenuItem(LTele, 0, "Las Venturas");//0
	AddMenuItem(LTele, 0, "Los Santos");//1
	AddMenuItem(LTele, 0, "San Fierro");//2
	AddMenuItem(LTele, 0, "The Desert");//3
	AddMenuItem(LTele, 0, "Flint Country");//4
	AddMenuItem(LTele, 0, "Mount Chiliad");//5
	AddMenuItem(LTele, 0, "Interiors");//6
	AddMenuItem(LTele, 0, "Return");//8

	LasVenturasMenu = CreateMenu("Las Venturas", 2,  55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(LasVenturasMenu, 0, "Teleport to where?");
	AddMenuItem(LasVenturasMenu, 0, "The Strip");//0
	AddMenuItem(LasVenturasMenu, 0, "Come-A-Lot");//1
	AddMenuItem(LasVenturasMenu, 0, "LV Airport");//2
	AddMenuItem(LasVenturasMenu, 0, "KACC Military Fuels");//3
	AddMenuItem(LasVenturasMenu, 0, "Yellow Bell Golf Club");//4
	AddMenuItem(LasVenturasMenu, 0, "Baseball Pitch");//5
	AddMenuItem(LasVenturasMenu, 0, "Return");//6

	LosSantosMenu = CreateMenu("Los Santos", 2,  55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(LosSantosMenu, 0, "Teleport to where?");
	AddMenuItem(LosSantosMenu, 0, "Ganton");//0
	AddMenuItem(LosSantosMenu, 0, "LS Airport");//1
	AddMenuItem(LosSantosMenu, 0, "Ocean Docks");//2
	AddMenuItem(LosSantosMenu, 0, "Pershing Square");//3
	AddMenuItem(LosSantosMenu, 0, "Verdant Bluffs");//4
	AddMenuItem(LosSantosMenu, 0, "Santa Maria Beach");//5
	AddMenuItem(LosSantosMenu, 0, "Mulholland");//6
	AddMenuItem(LosSantosMenu, 0, "Richman");//7
	AddMenuItem(LosSantosMenu, 0, "Return");//8

	SanFierroMenu = CreateMenu("San Fierro", 2,  55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(SanFierroMenu, 0, "Teleport to where?");
	AddMenuItem(SanFierroMenu, 0, "SF Station");//0
	AddMenuItem(SanFierroMenu, 0, "SF Airport");//1
	AddMenuItem(SanFierroMenu, 0, "Ocean Flats");//2
	AddMenuItem(SanFierroMenu, 0, "Avispa Country Club");//3
	AddMenuItem(SanFierroMenu, 0, "Easter Basin (docks)");//4
	AddMenuItem(SanFierroMenu, 0, "Esplanade North");//5
	AddMenuItem(SanFierroMenu, 0, "Battery Point");//6
	AddMenuItem(SanFierroMenu, 0, "Return");//7

	DesertMenu = CreateMenu("The Desert", 2,  55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(DesertMenu, 0, "Teleport to where?");
	AddMenuItem(DesertMenu, 0, "Aircraft Graveyard");//0
	AddMenuItem(DesertMenu, 0, "Area 51");//1
	AddMenuItem(DesertMenu, 0, "The Big Ear");//2
	AddMenuItem(DesertMenu, 0, "The Sherman Dam");//3
	AddMenuItem(DesertMenu, 0, "Las Barrancas");//4
	AddMenuItem(DesertMenu, 0, "El Quebrados");//5
	AddMenuItem(DesertMenu, 0, "Octane Springs");//6
	AddMenuItem(DesertMenu, 0, "Return");//7

	FlintMenu = CreateMenu("Flint Country", 2,  55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(FlintMenu, 0, "Teleport to where?");
	AddMenuItem(FlintMenu, 0, "The Lake");//0
	AddMenuItem(FlintMenu, 0, "Leafy Hollow");//1
	AddMenuItem(FlintMenu, 0, "The Farm");//2
	AddMenuItem(FlintMenu, 0, "Shady Cabin");//3
	AddMenuItem(FlintMenu, 0, "Flint Range");//4
	AddMenuItem(FlintMenu, 0, "Becon Hill");//5
	AddMenuItem(FlintMenu, 0, "Fallen Tree");//6
	AddMenuItem(FlintMenu, 0, "Return");//7

	MountChiliadMenu = CreateMenu("Mount Chiliad", 2,  55.0, 200.0, 100.0, 80.0);
	SetMenuColumnHeader(MountChiliadMenu, 0, "Teleport to where?");
	AddMenuItem(MountChiliadMenu, 0, "Chiliad Jump");//0
	AddMenuItem(MountChiliadMenu, 0, "Bottom Of Chiliad");//1
	AddMenuItem(MountChiliadMenu, 0, "Highest Point");//2
	AddMenuItem(MountChiliadMenu, 0, "Chiliad Path");//3
	AddMenuItem(MountChiliadMenu, 0, "Return");//7

	InteriorsMenu = CreateMenu("Interiors", 2,  55.0, 200.0, 130.0, 80.0);
	SetMenuColumnHeader(InteriorsMenu, 0, "Teleport to where?");
	AddMenuItem(InteriorsMenu, 0, "Planning Department");//0
	AddMenuItem(InteriorsMenu, 0, "LV PD");//1
	AddMenuItem(InteriorsMenu, 0, "Pizza Stack");//2
	AddMenuItem(InteriorsMenu, 0, "RC Battlefield");//3
	AddMenuItem(InteriorsMenu, 0, "Caligula's Casino");//4
	AddMenuItem(InteriorsMenu, 0, "Big Smoke's Crack Palace");//5
	AddMenuItem(InteriorsMenu, 0, "Madd Dogg's Mansion");//6
	AddMenuItem(InteriorsMenu, 0, "Dirtbike Stadium");//7
	AddMenuItem(InteriorsMenu, 0, "Vice Stadium (duel)");//8
	AddMenuItem(InteriorsMenu, 0, "Ammu-nation");//9
	AddMenuItem(InteriorsMenu, 0, "Atrium");//7
	AddMenuItem(InteriorsMenu, 0, "Return");//8
	#endif

	for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) OnPlayerConnect(i);
	for(new i = 1; i < MAX_CHAT_LINES; i++) Chat[i] = "<none>";
	for(new i = 1; i < MAX_REPORTS; i++) Reports[i] = "<none>";

	PingTimer = SetTimer("PingKick",5000,1);
	GodTimer = SetTimer("GodUpdate",2000,1);
	SetTimer("MoneyGrubScoreUpdate", 1000, 1);
	SetTimer("ForbiddenAreasTimer", 1000, 1);
	SetTimer("Warning1", 360000, 0);
	Speeder = SetTimer("SpeedHack", 1000, 1);
	ShowNameTags(true);
	ShowPlayerMarkers(PLAYER_MARKERS_MODE_GLOBAL);

    AdminLoungeEnter = CreateDynamicPickup(1239,23,1546.5767,-1269.4504,17.4063, -1, -1, -1);
	AdminLoungeExit = CreateDynamicPickup(1273,23,2523.6482,-1285.8982,1054.6406, -1, -1, -1);
	AdminRoofEnter = CreateDynamicPickup(1239,23,2548.9036,-1294.7700,1060.9844, -1, -1, -1);
	AdminRoofExit = CreateDynamicPickup(1273,23,1593.2964,-1240.0598,277.8764, -1, -1, -1);
	// (b1) entrance/exit pickups
	#if INIT_MAP_MYLAND == 1
	CreateDynamicPickup(1239, 23, 301.6825, 305.2616, 1003.5390, 311287, 4, -1); // Weapons Facility (b1) exit [1]
    CreateDynamicPickup(1239, 23, 234.2267, 1064.6352, 1084.2109, 311287, 6, -1); // Mansion (b1) front exit [4]
    CreateDynamicPickup(1239, 23, 232.3971, 1085.6048, 1084.2331, 311287, 6, -1); // Mansion (b1) back exit [5]
	#endif

	JailHelp = CreateDynamicPickup(1239, 23, 798.0007,-2746.2046,3.0417, 31121987, -1, -1);

	bankpickup = CreateDynamicPickup(1274,23,595.3339,-1249.9557,18.2670, -1, -1, -1);
	bankexit = CreateDynamicPickup(1274,23,2305.2278,-16.1282,26.7422, -1, -1, -1);

	LicenceCentre = CreateDynamicPickup(1239,23, 1219.3269,-1812.5309,16.5938, -1, -1, -1);
	LicenceExit = CreateDynamicPickup(1239,23, 1168.6493,1361.0414,10.9293, -1, -1, -1);
	CreateNewbieSpawn();
	LoadAdminCars();
	LoadVIPVehicles();

	// VIP
	VIPEnter = CreateDynamicPickup(1318,23,1788.4669,-1297.8236,13.3750, -1, -1, -1);
	VIPExit = CreateDynamicPickup(1318,23,1804.2808,-1299.5669,109.3359, -1, -1, -1);
	CreateDynamicPickup(359, 3, 1794.8350,-1296.3881,109.3359, -1, -1, -1);
	CreateDynamicPickup(367, 3, 1791.3262,-1301.8802,109.3359, -1, -1, -1);
	CreateDynamicPickup(326, 3, 1790.8308,-1299.2198,109.3359, -1, -1, -1);
	CreateDynamicPickup(343, 3, 1788.7621,-1306.6797,109.3359, -1, -1, -1);
	CreateDynamicPickup(361, 3, 1796.8029,-1295.9866,109.3359, -1, -1, -1);

	// AHQ2 Pickups
	CreateDynamicPickup(358, 3, 787.3569,-2848.7214,4.5742, 311287, -1, -1);
	CreateDynamicPickup(359, 3, 768.7079,-2845.1155,4.8516, 311287, -1, -1);
	CreateDynamicPickup(362, 3, 787.3569,-2848.7214,4.5742, 311287, -1, -1);


	CreateDynamicObject(987,1073.38000000,1359.82000000,9.61719000,0.00000000,0.00000000,180.00000000); // jail gate
	CreateDynamicObject(3461,-127.52500000,2258.44000000,25.85780000,0.00000000,0.00000000,0.00000000); // mafia torch
	#if CHRISTMAS_BUILD == 1
	CreateDynamicObject(19076, 2539.31, -1474.36, 23.00,   0.00, 0.00, 0.00); // Tree at carwash
	#endif
	CreateDynamicObject(1278,1077.94000000,1224.01000000,23.93750000,0.00000000,0.00000000,0.00000000); //
	CreateDynamicObject(1622,1057.52000000,1302.69000000,18.67070000,0.00000000,0.00000000,165.00000000); //
	CreateDynamicObject(1496,1167.93000000,1362.90000000,9.80000000,0.00000000,0.00000000,0.00000000); // licence centre door
	CreateDynamicObject(13649,2510.45360000,-1469.47390000,23.00000000,0.00000000,0.00000000,0.00000000); //

	//IsPlayerInVipArea = isPlayerInArea(playerid,1113.5094,1143.4122,-13.3531,12.5929);

	// Stunt Vehicles
	StuntBike1 = CreateVehicle(468,-1459.1265,1599.6443,1052.4192,299.3635,0,0,AV_RESPAWN_TIME); LinkVehicleToInterior(StuntBike1,14);
	StuntBike2 = CreateVehicle(468,-1446.8176,1569.6361,1052.4186,319.3959,0,0,AV_RESPAWN_TIME); LinkVehicleToInterior(StuntBike2,14);
	StuntQuad1 = CreateVehicle(471,-1447.4277,1585.9836,1052.2311,315.2468,0,0,AV_RESPAWN_TIME); LinkVehicleToInterior(StuntQuad1,14); SetVehicleNumberPlate(StuntQuad1, "5TunT3r");
	// end
	// Gates
	b1AutoGateStatus[0] = 0;
	b1AutoGateStatus[1] = 0;
	// FC Crap
	FcProtOn = 1;
	Fcopen = 0;
    FCgate1 = CreateDynamicObject(972, 2184.82, -1781.71, 7.7, 0, 0, 90);         // FC
	// end
	JeromeOwns = AddStaticVehicle(518,419.0665,2544.1470,16.0403,269.5519,0,0); AddVehicleComponent(JeromeOwns, 1010);  AddVehicleComponent(JeromeOwns, 1087); AddVehicleComponent(JeromeOwns,1078);
	
	AreaTimer = SetTimer("CheckPlayerAreas", 1000, 1); // Checks player area's for things such as place entry/exit.
	hackchecktimer = SetTimer("GlobalHackCheck", 1000, 1); AcActive =1; // leet anti-cheat based on Luk0r's DUCK AC
    WantedTimer = SetTimer("StartFuckingGame", 900000, false);
    RepairTimer = SetTimer("AutoRepair", 2500, true);
   	StatsTimer = SetTimer("GlobalStatsSave", 300000, 1);
    SetTimer("weatherchange",1200000,true);
    // Below is a new way to time shit
    TwentyTimer = SetTimer("TwentyMinuteTimer", 1200000, 1);

	SetNameTagDrawDistance(40.0);

    WantedGameOn = 0;
    // Spawn Weapons
    SpawnMenu = CreateDynamicPickup(2061, 19, 301.1602,-84.8938,1001.5156, -1, -1, -1);
    SpawnMenu2 = CreateDynamicPickup(2061, 19, 286.2152,-30.5288,1001.5156, -1, -1, -1);

	new year,month,day;	getdate(year, month, day);
	new hour,minute,second; gettime(hour,minute,second);

	test = TextDrawCreate(615.0, 400.0, "----"); // My elite login textdraw, shows a Textdraw for administrators
	TextDrawBackgroundColor(test,COLOR_BLACK);   // when a player logs in. Also shows level if applicable - Jerome
	TextDrawFont(test,1);
	TextDrawLetterSize(test,0.3,0.8);
	TextDrawSetOutline(test,1);
	TextDrawColor(test,PEPPERMINT);
	TextDrawSetProportional(test,1);
	TextDrawSetShadow(test,12);
	TextDrawAlignment(test,3);

    //Put All AddCCTV-lines here below:
	//======================================================
	//======================================================
	AddCCTV("Fight Club", 2128.5889,-1788.6390,33.7214,110.0);
	AddCCTV("Safezone Cam 1", 810.0844,-1091.6140,28.7483, 220.0);
	AddCCTV("Safezone Cam 2", 823.6760,-1111.5981,33.8828, 295.0);
	AddCCTV("Ammu Cam", 1332.7668,-1290.9919,35.6641, 270.0);
	AddCCTV("Bank", 615.2305,-1192.9855,45.2497, 160.0);
	AddCCTV("The Quarry", 664.6382,802.8278,-30.1635, 45.0);
	//======================================================
    //======================================================

	//Creating Textdraw
	TD = TextDrawCreate(160, 400, "~y~Keys:~n~Arrow-Keys: ~w~Move The Camera~n~~y~Sprint-Key: ~w~Speed Up~n~~y~Crouch-Key: ~w~Exit Camera");
    TextDrawLetterSize(TD, 0.4, 0.9);
    TextDrawSetShadow(TD, 0);
    TextDrawUseBox(TD,1);
	TextDrawBoxColor(TD,0x00000055);
	TextDrawTextSize(TD, 380, 400);

	//Creating Menu's
	new Count, Left = TotalCCTVS;
	for(new menu; menu<MAX_CCTVMENUS; menu++)
	{
	    if(Left > 12)
	    {
	        CCTVMenu[menu] = CreateMenu("Choose Camera:", 1, 200, 100, 220);
	        TotalMenus++;
	        MenuType[menu] = 1;
	        for(new i; i<11; i++)
	        {
	        	AddMenuItem(CCTVMenu[menu], 0, CameraName[Count]);
	        	Count++;
	        	Left--;
			}
			AddMenuItem(CCTVMenu[menu], 0, "Next");
		}
		else if(Left<13 && Left > 0)
		{
		    CCTVMenu[menu] = CreateMenu("Choose Camera:", 1, 200, 100, 220);
		    TotalMenus++;
		    MenuType[menu] = 2;
		    new tmp = Left;
	        for(new i; i<tmp; i++)
	        {
	        	AddMenuItem(CCTVMenu[menu], 0, CameraName[Count]);
	        	Count++;
	        	Left--;
			}
		}
	}
	// Property Initiation //
	LoadProperties();
    MP = GetMaxPlayers();
	for(new i; i<MP; i++)
	{
	    if(IsPlayerConnected(i))
	    {
            new pName2[MAX_PLAYER_NAME];
			GetPlayerName(i, pName2, MAX_PLAYER_NAME);
			for(new propid; propid < PropertiesAmount; propid++)
			{
				if(PropInfo[propid][PropIsBought] == 1)
				{
				    if(strcmp(PropInfo[propid][PropOwner], pName2, true)==0)
					{
					    EarningsForPlayer[i] += PropInfo[propid][PropEarning];
					    PlayerProps[i]++;
					}
				}
			}
		}
	}
    SetTimer("UpdateUnbuyableTime", 60000, 1);
	SetTimer("PropertyPayout", 900000, 1);

//---------------------------- omg -----------------------------------------//

    SetGameModeText("LSX "#LVXVersion""); // What is the gamemode called?

    SetTimer("Keys", 100, 1);
	SetTimer("irdrunk", 1000, 1);
	WebUrl = TextDrawCreate(24.000000,430.000000,"www.playlsx.net");
	//TextDrawUseBox(WebUrl,1);
	//TextDrawBoxColor(WebUrl,0x00000066);
	TextDrawTextSize(WebUrl,153.000000,-59.000000);
	TextDrawBackgroundColor(WebUrl,0x000000ff);
	TextDrawFont(WebUrl,2);
	TextDrawLetterSize(WebUrl,0.299999,0.899999);
	TextDrawColor(WebUrl,0x00ff00ff);
	//TextDrawSetOutline(WebUrl,1);
	//TextDrawSetProportional(WebUrl,1);
	//TextDrawSetShadow(WebUrl,1);

	

	#if CHRISTMAS_BUILD == 1

	Christmas = TextDrawCreate(179.000000,187.000000,"Merry Christmas");
	TextDrawAlignment(Christmas,0);
	TextDrawBackgroundColor(Christmas,red);
	TextDrawFont(Christmas,0);
	TextDrawLetterSize(Christmas,1.400000,4.199999);
	TextDrawColor(Christmas,MANAGEMENT);
	TextDrawSetProportional(Christmas,1);
	TextDrawSetShadow(Christmas,1);

	new yString[5],y,m,d;
	getdate(y,m,d);
	format(yString, sizeof(yString), "%d", y);
	Year = TextDrawCreate(266.000000,245.000000,yString);
	TextDrawAlignment(Year,0);
	TextDrawBackgroundColor(Year,0xff000033);
	TextDrawFont(Year,2);
	TextDrawLetterSize(Year,1.000000,3.099999);
	TextDrawColor(Year,0x0000ffff);
	TextDrawSetOutline(Year,1);
	TextDrawSetProportional(Year,1);
	TextDrawSetShadow(Year,1);

	#endif
/*
	WeekDayg = TextDrawCreate(502.000000,11.000000,"----");
	TextDrawAlignment(WeekDayg,0);
	TextDrawBackgroundColor(WeekDayg,0x000000FF);
	TextDrawFont(WeekDayg,3);
	TextDrawLetterSize(WeekDayg,0.700000,1.000000);
	TextDrawColor(WeekDayg,AdminRed);
	TextDrawSetOutline(WeekDayg,1);
	TextDrawSetProportional(WeekDayg,1);
	TextDrawSetShadow(WeekDayg,10);
*/
    Clock = TextDrawCreate(547.0, 24.0, "--:--");
	TextDrawLetterSize(Clock, 0.6, 1.8);
	TextDrawFont(Clock, 3);
	TextDrawSetOutline(Clock, 2);


	fcinfo = CreateDynamicPickup(1239, 23, 2178.8601,-1782.4286,13.5278, -1, -1, -1);
	uzi2 = CreateDynamicPickup(352, 2, 1488.6412,2775.7268,10.8203, -1, -1, -1);
	sawnoff2 = CreateDynamicPickup(350, 2, 1488.1882,2770.5801,10.8203, -1, -1, -1);
	SecretHax1 = CreateDynamicPickup(954,1,2591.8022,2341.2183,10.8203, -1, -1, -1);
	SetTimer("msgtimer",300000,1);

	AddMoneyArea(1, 810.3149,820.8247,-1109.3395,-1091.6564, 100, 1);
	shippickup = CreateDynamicPickup(1239, 23 ,823.7537,-1105.3197,25.7964, -1, -1, -1);
	SetTimer("load",2000,0);

	UsePlayerPedAnims();

		// Player Classes

	for ( new i = 280; i < 300; i++ )
        if ( IsValidSkin( i ) )							AddPlayerClass( i,1958.3783, 1343.1572, 15.3746, 270.1425, 0, 0, 0, 0, 0, 0 );

	for ( new i = 0; i < 280; i++ )
	{
	    // 217 - Male Staff
	    // 211 - Female Staff

	    if ( IsValidSkin( i ) && i != 217 && i != 211 )	AddPlayerClass( i,1958.3783, 1343.1572, 15.3746, 270.1425, 0, 0, 0, 0, 0, 0 );
	}
	// Vehicles
	new total_vehicles_from_files=0;

	total_vehicles_from_files += LoadStaticVehiclesFromFile("lsx/vehicles/bone.txt");
	total_vehicles_from_files += LoadStaticVehiclesFromFile("lsx/vehicles/ls_airport.txt");
	total_vehicles_from_files += LoadStaticVehiclesFromFile("lsx/vehicles/ls_law.txt");
	total_vehicles_from_files += LoadStaticVehiclesFromFile("lsx/vehicles/ls_gen_inner.txt");
	total_vehicles_from_files += LoadStaticVehiclesFromFile("lsx/vehicles/ls_gen_outer.txt");
	total_vehicles_from_files += LoadStaticVehiclesFromFile("lsx/vehicles/lv_gen.txt");
    total_vehicles_from_files += LoadStaticVehiclesFromFile("lsx/vehicles/red_county.txt");
    // Las Venturas
    CreateVehicle(400,-1535.2211,2570.4077,55.9282,90.1002,40,1,V_RESPAWN_TIME); // Landstalker
	CreateVehicle(401,-1500.9108,2643.9609,55.5393,178.7070,74,74,V_RESPAWN_TIME); // Bravura
	CreateVehicle(402,1502.1853,2258.4932,10.6519,180.1491,30,30,V_RESPAWN_TIME); // Buffalo
	CreateVehicle(407,1763.7743,2076.8972,11.0579,179.9942,3,1,V_RESPAWN_TIME); // Firetruck
	CreateVehicle(411,-1272.9263,2707.1995,49.7932,210.0322,116,1,V_RESPAWN_TIME); // Infernus
	CreateVehicle(436,1685.6946,1297.3134,10.5884,0.3087,87,1,V_RESPAWN_TIME); // Previon
	CreateVehicle(437,1109.9398,1737.8418,10.9537,267.3920,95,16,V_RESPAWN_TIME); // Coach
	CreateVehicle(457,1241.4476,2756.7625,10.4470,59.8293,63,1,V_RESPAWN_TIME); // Caddy
	CreateVehicle(460,1626.8618,568.4694,1.4902,178.6719,1,9,V_RESPAWN_TIME); // Skimmer
	CreateVehicle(476,1392.7075,1771.9775,11.5364,221.6890,119,117,V_RESPAWN_TIME); // Rustler
	CreateVehicle(477,1497.7853,770.4979,10.5734,91.0072,0,1,V_RESPAWN_TIME); // ZR-350
	CreateVehicle(480,1876.4121,1179.5653,10.6059,359.0063,2,2,V_RESPAWN_TIME); // Comet
	CreateVehicle(487,1621.5431,1624.5344,10.9966,179.1056,54,29,V_RESPAWN_TIME); // Maverick
	CreateVehicle(487,1634.2834,1544.0182,10.9736,7.0662,26,3,V_RESPAWN_TIME); // Maverick
	CreateVehicle(488,2092.5464,2414.8848,74.7556,270.4580,1,6,V_RESPAWN_TIME); // Maverick
    CreateVehicle(504,2613.7126,1434.0278,10.6128,144.1867,57,38,V_RESPAWN_TIME); // bloodring :D
	CreateVehicle(519,1339.8572,1566.3240,11.7425,271.2929,1,1,V_RESPAWN_TIME); // Shamal
	CreateVehicle(522,-232.1536,2595.0967,62.2747,3.1030,8,82,V_RESPAWN_TIME); // NRG-500
	CreateVehicle(541,1491.9773,711.4294,10.2969,82.8536,68,8,V_RESPAWN_TIME); // Bullet
	CreateVehicle(542,-865.5502,1566.3243,24.5221,271.7548,45,92,V_RESPAWN_TIME); // Clover
	CreateVehicle(549,-236.5799,1186.4707,19.4395,333.1385,75,39,V_RESPAWN_TIME); // Tampa
	CreateVehicle(550,1554.1504,1019.3770,10.6357,270.9093,53,53,V_RESPAWN_TIME); // Sunrise
	CreateVehicle(560,1113.1652,1786.4479,10.5251,271.3909,17,1,V_RESPAWN_TIME); // Sultan
	CreateVehicle(581,-903.8008,1515.5464,25.5025,182.1489,72,1,V_RESPAWN_TIME); // BF-400
	CreateVehicle(602,2094.7979,2479.8733,10.6260,359.0253,13,1,V_RESPAWN_TIME); // Alpha
    // San Fierro
	CreateVehicle(404,-2442.8020,956.2106,45.0318,90.2788,66,25,V_RESPAWN_TIME); // Perrenial
	CreateVehicle(404,-2512.5593,1209.6479,37.1563,90.2582,109,100,V_RESPAWN_TIME); // Perrenial
	CreateVehicle(404,-2571.4897,621.9541,14.1862,269.8713,83,110,V_RESPAWN_TIME); // Perrenial
	CreateVehicle(404,-2599.1038,55.7722,3.9869,1.1465,113,39,V_RESPAWN_TIME); // Perrenial
	CreateVehicle(404,-2672.8184,-35.2818,4.0695,179.9820,119,50,V_RESPAWN_TIME); // Perrenial
	CreateVehicle(405,-2342.4333,573.2051,26.9932,88.5843,123,1,V_RESPAWN_TIME); // Sentinel
	CreateVehicle(405,-2439.8271,142.1763,34.9041,89.9210,36,1,V_RESPAWN_TIME); // Sentinel
	CreateVehicle(407,-2021.2549,75.8561,28.2791,274.1026,3,1,V_RESPAWN_TIME); // Firetruck
	CreateVehicle(409,-1755.9644,954.0494,24.5421,89.7680,1,1,V_RESPAWN_TIME); // Stretch
	CreateVehicle(409,-2414.1318,331.1130,34.7705,150.4144,1,1,V_RESPAWN_TIME); // Stretch
	CreateVehicle(411,-2687.5532,899.1608,79.3536,100.6872,116,1,V_RESPAWN_TIME); // Infernus
	CreateVehicle(415,-1358.1704,-203.9184,13.9193,262.1334,92,1,V_RESPAWN_TIME); // Cheetah
	CreateVehicle(416,-2647.4829,583.8292,14.6025,269.6258,1,3,V_RESPAWN_TIME); // Ambulance
	CreateVehicle(427,-1596.3585,747.8926,-5.1108,180.1896,0,1,V_RESPAWN_TIME); // Enforcer
	CreateVehicle(427,-1622.3502,652.2515,7.3194,0.5055,0,1,V_RESPAWN_TIME); // Enforcer
	CreateVehicle(429,-2201.3914,293.3576,34.7969,180.3029,12,12,V_RESPAWN_TIME); // Banshee
	CreateVehicle(445,-2701.6489,124.3519,4.1284,0.8701,41,41,V_RESPAWN_TIME); // Admiral
	CreateVehicle(457,-2303.9568,-241.8265,42.5280,267.5589,58,1,V_RESPAWN_TIME); // Caddy
	CreateVehicle(457,-2377.5229,-252.0375,42.4037,222.2731,34,1,V_RESPAWN_TIME); // Caddy
    // Static Vehicles

    AddStaticVehicle(538,1466.7051,2634.2603,10.5424,269.5424,1,1); // brown steak hax
    AddStaticVehicle(449,-2264.9897,526.9444,35.2965,180.0000,1,1); // Tram
	//Pickups & Objects:

	#if CHRISTMAS_BUILD == 1
	    #include "lsx_inc/Christmas/objects.pwn"
	#endif

	CreateDynamicPickup(1240,2,2142.5410,-1802.8008,16.1475, -1, -1, -1); //FC Pickup Armour
	CreateDynamicPickup(1242,2,2175.3394,-1831.2729,16.1406, -1, -1, -1);// FC Pickup Health
	#if CHRISTMAS_BUILD == 1
	CreateDynamicPickup(1242,2,1127.0773,-1453.7225,16.9923,-1,-1,-1); // Tree health
	#endif
	CreateDynamicPickup(1240,2,2532.2756,-1475.9022,23.9904, -1, -1, -1);// Newbie Armour
	CreateDynamicPickup(1242,2,2533.6260,-1476.0006,23.9970, -1, -1, -1); // Newb health
	CreateDynamicPickup(1240,2,810.7681,-1098.2798,25.9063, -1, -1, -1);
	CreateDynamicPickup(1240,2,1174.9673,-1338.8142,13.9904, -1, -1, -1);
	CreateDynamicPickup(1242,2,811.9885,-1098.3256,25.9063, -1, -1, -1);

	#include "lsx_inc/Objects.pwn"


/*
	// Duel Arena
	CreateObject(1223, 2184.66, -1848.57, 7019.3, 0, 0, 180);
	CreateObject(3366, 2195.53, -1835.29, 7020.1, 0, 0, 0);
	CreateObject(987, 2185.9, -1835.38, 7019.5, 0, 0, 90);
	CreateObject(987, 2185.83, -1823.4, 7019.5, 0, 0, 90);
	CreateObject(1223, 2184.11, -1822.64, 180, 0, 0, 0);
	CreateObject(13608, 2193.58, -1836.29, 7033.1 ,0, 0, 0);
	CreateObject(13622, 2193.79, -1836.83, 7033.1 ,0, 0, 0);
	CreateObject(1215, 2187.11, -1848.4, 7020, 0, 0, 0);
	CreateObject(1215, 2186.64, -1821.73, 7020, 0, 0, 0); */
//--------------------------------------------------------------------------//


	print("________________PlayLSX_________________");
	print("LSX Version        "#LVXVersion"        ");
	print("Last updated       "#LASTUPDATE"        ");
	print("The time was       "#TIMEUPDATE"        ");
	print("________________________________________");
	print("         Successfully Loaded            ");
	printf("     Date: %d/%d/%d  Time: %d:%d :%d   ",day,month,year, hour, minute, second);
	print("________________________________________");

	return 1;
}

//==============================================================================
public OnGameModeExit()
{
	// 3D text labels here
	Delete3DTextLabels();
	DestroyAllPropertyPickups();
	DestroyDynamicCP(Export_CP);
	KillTimer(PingTimer);
	KillTimer(RepairTimer);
	KillTimer(GodTimer);
	KillTimer(hackchecktimer);
	KillTimer(TwentyTimer);
	KillTimer(WantedTimer);
	KillTimer(StatsTimer);
	KillTimer(ShipTimer);
	KillTimer(Speeder);
	KillTimer(AreaTimer);
	FcProtOn = 0;
	#if defined USE_MENUS
	DestroyAllMenus();
	#endif
	#if IRC_ENABLED == 1
	// Disconnect the first bot
	IRC_Quit(gBotID[0], "Fuck you.");
	// Disconnect the second bot
	IRC_Quit(gBotID[1], "Fuck you too..");
	// Destroy the group
	IRC_DestroyGroup(gGroupID);
	#endif

    TextDrawHideForAll(TD);
	TextDrawDestroy(TD);
	for(new i; i<TotalMenus; i++)
	{
		DestroyMenu(CCTVMenu[i]);
	}


	new year,month,day;	getdate(year, month, day);
	new hour,minute,second; gettime(hour,minute,second);
	print("\n________________________________________");
	print("________________________________________");
	print("        Los Santos Xtreme Exiting       ");
	print("________________________________________");
	printf("     Date: %d/%d/%d  Time: %d:%d :%d   ",day,month,year, hour, minute, second);
	print("________________________________________");
	print("________________________________________\n");
	return 1;
}

//------------------------------ AUDIO CODE -----------------------------

public
	Audio_OnClientConnect(playerid)
{
	new string[128];
	format(string, sizeof(string), "Connected to Audio Server [ID:%d]", playerid);
	SendClientMessage(playerid, grey, string);
	format(string, sizeof(string), "Audio Bot: %s [ID:%d] is now connected to the audio server.", pName(playerid), playerid);
	print(string);
	// Transfer the audio pack when the player connects
	Audio_TransferPack(playerid);
	return 1;
}

public
	Audio_OnClientDisconnect(playerid)
{
	new string[128];
	format(string, sizeof(string), "Audio Bot: %s [ID:%d] is now disconnected from the audio server.", pName(playerid), playerid);
	print(string);
	return 1;
}

public
	Audio_OnPlay(playerid, handleid)
{
/*	new
		string[64];
	format(string, sizeof(string), "Audio Bot: Audio playback started for handle ID %d", handleid);
	SendClientMessage(playerid, PEPPERMINT, string); */
	return 1; 
}

public
	Audio_OnStop(playerid, handleid)
{
/*	new
		string[64];
	format(string, sizeof(string), "Audio Bot: Audio playback stopped for handle ID %d", handleid);
	SendClientMessage(playerid, PEPPERMINT, string); */
	return 1;
}

public
	Audio_OnSetPack(audiopack[])
{
	new
		string[64];
	format(string, sizeof(string), "Audio Bot: Audio pack \"%s\" set", audiopack);
	SendClientMessageToAll(PEPPERMINT, string);
	for (new i = 0; i < MAX_PLAYERS; i++)
	{
		// Transfer the audio pack to all players when it is set
		Audio_TransferPack(i);
	}
	return 1;
}

public
	Audio_OnTransferFile(playerid, file[], current, total, result)
{
	new
		string[128];
	switch (result)
	{
		case 0:
		{
			format(string, sizeof(string), "Audio Bot: Audio file \"%s\" (%d of %d) finished local download", file, current, total);
		}
		case 1:
		{
			format(string, sizeof(string), "Audio Bot: Audio file \"%s\" (%d of %d) finished remote download", file, current, total);
		}
		case 2:
		{
			format(string, sizeof(string), "Audio Bot: Audio archive \"%s\" (%d of %d) finished extraction", file, current, total);
		}
		case 3:
		{
			format(string, sizeof(string), "Audio Bot: Audio file/archive \"%s\" (%d of %d) passed check", file, current, total);
		}
		case 4:
		{
			format(string, sizeof(string), "Audio Bot: Audio file/archive \"%s\" (%d of %d) could not be downloaded or extracted", file, current, total);
		}
	}
	SendClientMessage(playerid, PEPPERMINT, string);
	if (current == total)
	{
		SendClientMessage(playerid, PEPPERMINT, "Audio Bot: All files have been processed");
	}
	return 1;
}

public
	Audio_OnTrackChange(playerid, handleid, track[])
{
	new
		string[128]; // Will integrate message options later on.
	format(string, sizeof(string), "Audio Bot: Now playing \"%s\" [StationID:%d]", track, handleid);
	SendClientMessage(playerid, PEPPERMINT, string);
	format(string, sizeof(string), "Now Playing :: \"%s\" :: [StationID:%d]", track, handleid);
	SetPlayerChatBubble(playerid, string, PEPPERMINT, 25.0, 10000);
}
//-----------------------------------------------------------------------

// ================= New IRC Echo Completely rewritten for 0.3 -_- ===========//
//================== Many thanks to Incognito for his plugin o/ ==============//
#if IRC_ENABLED == 1 // Is IRC enabled?!
//=========================

forward
	IRC_ConnectDelay(tempid);

public
	IRC_ConnectDelay(tempid)
{
	switch (tempid)
	{
		case 1:
		{
			// Connect the first bot
			gBotID[0] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_1_NICKNAME, BOT_1_REALNAME, BOT_1_USERNAME, true); // ssl connecttion
		}
		case 2:
		{
			// Connect the second bot
			gBotID[1] = IRC_Connect(IRC_SERVER, IRC_PORT, BOT_2_NICKNAME, BOT_2_REALNAME, BOT_2_USERNAME, true); // same
		}
	}
	return 1;
}

/*
	The IRC callbacks are below. Many of these are simply derived from parsed
	raw messages received from the IRC server. They can be used to inform the
	bot of new activity in any of the channels it has joined.
*/

public
	IRC_OnConnect(botid)
{
	printf("*** IRC_OnConnect: Bot ID %d connected!", botid);
	// Join the channel
	SetTimerEx("JoinChannels", 5000, 0, "i", botid);
	// Add the bot to the group
	IRC_AddToGroup(gGroupID, botid);
	return 1;
}

forward
	JoinChannels(botid);
public
	JoinChannels(botid)
{
	IRC_JoinChannel(botid, IRC_CHANNEL);
	IRC_JoinChannel(botid, CHAT_CHAN);
	IRC_JoinChannel(botid, VIP_CHAN, VIP_KEY);
	IRC_JoinChannel(botid, CREW_CHAN, CREW_KEY);
	return 1;
}

forward
	PartChannels(botid);
public
	PartChannels(botid)
{
	IRC_PartChannel(botid, IRC_CHANNEL);
	IRC_PartChannel(botid, CHAT_CHAN);
	IRC_PartChannel(botid, VIP_CHAN);
	IRC_PartChannel(botid, CREW_CHAN);
	return 1;
}

//Custom messaging functions
forward
	AddEcho(message[]);
public
	AddEcho(message[])
{
	IRC_GroupSay(gGroupID, IRC_CHANNEL, message);
	printf("Added Echo: %s", message);
	return 1;
}
/*
	Note that this callback is executed whenever a current connection is closed
	OR whenever a connection attempt fails. Reconnecting too fast can flood the
	IRC server and possibly result in a ban. It is recommended to set up
	connection reattempts on a timer, as demonstrated here.
*/

public
	IRC_OnDisconnect(botid)
{
	printf("*** IRC_OnDisconnect: Bot ID %d disconnected!", botid);
	if (botid == gBotID[0])
	{
		// Reset the bot ID
		gBotID[0] = 0;
		// Wait 20 seconds for the first bot
		SetTimerEx("IRC_ConnectDelay", 20000, 0, "d", 1);
	}
	else if (botid == gBotID[1])
	{
		// Reset the bot ID
		gBotID[1] = 0;
		// Wait 25 seconds for the second bot
		SetTimerEx("IRC_ConnectDelay", 25000, 0, "d", 2);
	}
	printf("*** IRC_OnDisconnect: Bot ID %d attempting to reconnect...", botid);
	// Remove the bot from the group
	IRC_RemoveFromGroup(gGroupID, botid);
	return 1;
}

public
	IRC_OnJoinChannel(botid, channel[])
{
	printf("*** IRC_OnJoinChannel: Bot ID %d joined channel %s!", botid, channel);
	return 1;
}

/*
	If the bot cannot immediately rejoin the channel (in the event, for example,
	that the bot is kicked and then banned), you might want to set up a timer
	here as well for rejoin attempts.
*/

public
	IRC_OnLeaveChannel(botid, channel[], message[])
{
	printf("*** IRC_OnLeaveChannel: Bot ID %d left channel %s (%s)!", botid, channel, message);
	IRC_JoinChannel(botid, channel);
	return 1;
}

public
	IRC_OnUserDisconnect(botid, user[], host[], message[])
{
	printf("*** IRC_OnUserDisconnect (Bot ID %d): User %s (%s) disconnected! (%s)", botid, user, host, message);
	return 1;
}

public
	IRC_OnUserJoinChannel(botid, channel[], user[], host[])
{
	printf("*** IRC_OnUserJoinChannel (Bot ID %d): User %s (%s) joined channel %s!", botid, user, host, channel);
	return 1;
}

public
	IRC_OnUserLeaveChannel(botid, channel[], user[], host[], message[])
{
	printf("*** IRC_OnUserLeaveChannel (Bot ID %d): User %s (%s) left channel %s (%s)!", botid, user, host, channel, message);
	return 1;
}

public
	IRC_OnUserNickChange(botid, oldnick[], newnick[], host[])
{
	printf("*** IRC_OnUserNickChange (Bot ID %d): User %s (%s) changed his nick to %s!", botid, oldnick, host, newnick);
	return 1;
}

public
	IRC_OnUserSetChannelMode(botid, channel[], user[], host[], mode[])
{
	printf("*** IRC_OnUserSetChannelMode (Bot ID %d): User %s (%s) on %s set mode: %s!", botid, user, host, channel, mode);
	return 1;
}

public
	IRC_OnUserSetChannelTopic(botid, channel[], user[], host[], topic[])
{
	printf("*** IRC_OnUserSetChannelTopic (Bot ID %d): User %s (%s) on %s set topic: %s!", botid, user, host, channel, topic);
	return 1;
}

public
	IRC_OnUserSay(botid, recipient[], user[], host[], message[])
{
	printf("*** IRC_OnUserSay (Bot ID %d): User %s (%s) sent message to %s: %s", botid, user, host, recipient, message);
	// Someone sent the first bot a private message
	if (!strcmp(recipient, BOT_1_NICKNAME))
	{
		IRC_Say(botid, user, "You sent me a PM!");
	}
	return 1;
}

public
	IRC_OnUserNotice(botid, recipient[], user[], host[], message[])
{
	printf("*** IRC_OnUserNotice (Bot ID %d): User %s (%s) sent notice to %s: %s", botid, user, host, recipient, message);
	// Someone sent the second bot a notice (probably a network service)
	if (!strcmp(recipient, BOT_2_NICKNAME))
	{
		IRC_Notice(botid, user, "You sent me a notice! How dare you!");
	}
	return 1;
}

/*
	This callback is useful for logging, debugging, or catching error messages
	sent by the IRC server.
*/

public
	IRC_OnReceiveRaw(botid, message[])
{
	new
		File:file;
	if (!fexist("irc_log.txt"))
	{
		file = fopen("irc_log.txt", io_write);
	}
	else
	{
		file = fopen("irc_log.txt", io_append);
	}
	if (file)
	{
		fwrite(file, message);
		fwrite(file, "\r\n");
		fclose(file);
	}
	return 1;
}

/*
	Some examples of channel commands are here. You can add more very easily;
	their implementation is identical to that of ZeeX's zcmd.
*/
/*
IRCCMD:join(botid, channel[], user[], host[], params[])
{
	if(IRC_IsOp(botid, channel, user))
	{
	    if(!isnull(params))
	    {
			new channel, msg[128], pass;
			if(sscanf(params, "s[100]z[100]", channel, pass))
			{
				IRC_JoinChannel(gBotID[0], channel
*/

/*
IRCCMD:trace(botid, channel[], user[], host[], params[])
{
	if(IRC_IsOp(botid, channel, user))
	{
	    new TraceIP;
	    if(sscanf(params, "d", TraceIP))
	    {
	        IRC_Notice(gGroupID, user, "You did not enter an IP address.");
		}
		else
		{
		    HTTP(user, HTTP_POST, "ip-adress.com/ip_tracer/", TraceIP, "TraceAddress");
			IRC_Say(gGroupID, user, "Trace request sent, Please wait..");
		}
	}
	return 1;
}

forward TraceAddress(index, response_code, data[]);
public TraceAddress(index, response_code, data[])
{
    new buffer[ 128 ];
    if(response_code == 200) //Did the request succeed?
    {
        //Yes!
        format(buffer, sizeof(buffer), " IP Trace complete: %s", data);
		IRC_Say(gGroupID,index,buffer);
    }
    else
    {
        //No!
        format(buffer, sizeof(buffer), " IP Trace failed: Could not connect to service. (%d)", response_code);
        IRC_Say(gGroupID,index,buffer);
    }
	return 1;
}
*/
#define iCMD IRCCMD

iCMD:mod(botid, channel[], user[], host[], params[])
{
	if(IRC_IsOp(botid, channel, user))
	{
	    new pID[80];
	    if(sscanf(params, "s", pID)) return IRC_Notice(botid, user, "You did not enter a name!");
		else
		{
		    IRC_SetMode(botid, pID, "+h");
		    IRC_Notice(botid, pID, "You have been given IRC moderator permissions.");
		}
	}
	return 1;
}

IRCCMD:kb(botid, channel[], user[], host[], params[])
{
	if(IRC_IsOp(botid, channel, user))
	{
	    if(!isnull(params))
	    {
	        new istr[128];
			format(istr, sizeof(istr), "PRIVMSG ChanServ AKICK %s add %s Goodbye.", channel, params); IRC_SendRaw(gGroupID, istr);
			format(istr, sizeof(istr), "3IRC: %s has been KB'd from #%s by %s", params, channel, user); IRC_GroupSay(gGroupID, CREW_CHAN, istr);
			format(istr, sizeof(istr),"IRC: %s has been banned on #%s.", params, channel); SendClientMessageToAll(Gray, istr);
		}
	}
	return 1;
}

IRCCMD:msg(botid, channel[], user[], host[], params[])
{
	// Check if the user has at least voice in the channel
	if (IRC_IsVoice(botid, channel, user))
	{
		// Check if the user entered any text
		if (!isnull(params))
		{
			new
				msg[128];
			// Echo the formatted message
			format(msg, sizeof(msg), "02*** %s on IRC: %s", user, params);
			AddEcho(msg);
			format(msg, sizeof(msg), "*** %s on IRC: %s", user, params);
			SendClientMessageToAll(White, msg);
		}
	}
	return 1;
}

IRCCMD:kick(botid, channel[], user[], host[], params[])
{
	// Check if the user is at least a halfop in the channel
	if (IRC_IsHalfop(botid, channel, user))
	{
		new
			playerid,
			reason[64];
		// If the user did not enter a player ID, then the command will not be processed
		if (sscanf(params, "dz", playerid, reason))
		{
			return 1;
		}
		// If the player is not connected, then nothing will be done
		if (IsPlayerConnected(playerid))
		{
			new
				msg[128],
				name[MAX_PLAYER_NAME];
			// If no reason is given, then "No reason" will be stated
			if (isnull(reason))
			{
				format(reason, sizeof(reason), "No reason");
			}
			// Echo the formatted message and kick the user
			GetPlayerName(playerid, name, sizeof(name));
			format(msg, sizeof(msg), "02*** %s has been kicked by %s on IRC. (%s)", name, user, reason);
			IRC_GroupSay(gGroupID, channel, msg);
			format(msg, sizeof(msg), "*** %s has been kicked by %s on IRC. (%s)", name, user, reason);
			SendClientMessageToAll(0x0000FFFF, msg);
			Kick(playerid);
		}
	}
	return 1;
}

IRCCMD:ban(botid, channel[], user[], host[], params[])
{
	// Check if the user is at least an op in the channel
	if (IRC_IsOp(botid, channel, user))
	{
		new
			playerid,
			reason[64];
		// If the user did not enter a player ID, then the command will not be processed
		if (sscanf(params, "dz", playerid, reason))
		{
			return 1;
		}
		// If the player is not connected, then nothing will be done
		if (IsPlayerConnected(playerid))
		{
			new
				msg[128],
				name[MAX_PLAYER_NAME];
			// If no reason is given, then "No reason" will be stated
			if (isnull(reason))
			{
				format(reason, sizeof(reason), "No reason");
			}
			// Echo the formatted message and ban the user
			GetPlayerName(playerid, name, sizeof(name));
			format(msg, sizeof(msg), "02*** %s has been banned by %s on IRC. (%s)", name, user, reason);
			IRC_GroupSay(gGroupID, channel, msg);
			format(msg, sizeof(msg), "*** %s has been banned by %s on IRC. (%s)", name, user, reason);
			SendClientMessageToAll(0x0000FFFF, msg);
			BanEx(playerid, reason);
		}
	}
	return 1;
}

IRCCMD:rcon(botid, channel[], user[], host[], params[])
{
	// Check if the user is at least an op in the channel
	if (IRC_IsOp(botid, channel, user))
	{
		// Check if the user entered any text
		if (!isnull(params))
		{
			// Check if the user did not enter any bad commands
			if (strcmp(params, "exit", true) != 0 && strfind(params, "loadfs irc", true) == -1)
			{
				// Echo the formatted message and send the command
				new
					msg[128];
				format(msg, sizeof(msg), "RCON command %s has been executed.", params);
				IRC_GroupSay(gGroupID, channel, msg);
				SendRconCommand(params);
			}
		}
	}
	return 1;
}
/*
IRCCMD:pm(botid, channel[], user[], host[], params[])
{
	if(IRC_IsVoice(botid, channel, user))
	{

	}
	return 1;
}
*/
//===============================//
#endif // End of IRC             ||
//===============================//

public msgtimer()
{

	SendClientMessageToAll(Red,"----------------------------------");
    SendClientMessageToAll(Yellow, NewsMsg[random(sizeof(NewsMsg))]);
    SendClientMessageToAll(Red,"----------------------------------");
}

//==============================================================================
public OnPlayerConnect(playerid)
{
    SetTimerEx("PlayerTimeOn", 60000, 1, "i", playerid);
    SetTimerEx("settime",1000,1, "i", playerid);
    
	PlayerInfo[playerid][Deaths] = 0;
	PlayerInfo[playerid][PlayerDynCar] = -1;
	PlayerInfo[playerid][Kills] = 0;
	PlayerInfo[playerid][Jailed] = 0;
	PlayerInfo[playerid][Frozen] = 0;
	PlayerInfo[playerid][TotalTime] = 0;
	PlayerInfo[playerid][TeleMsg] = 0;
	PlayerInfo[playerid][Level] = 0;
	PlayerInfo[playerid][FavSkin] = -1;
	PlayerInfo[playerid][Temped] = 0;
	PlayerInfo[playerid][LoggedIn] = 0;
	PlayerInfo[playerid][Registered] = 0;
	PlayerInfo[playerid][Cookies] = 0;
	PlayerInfo[playerid][HoldingObject] = 255;
	CurrentHoldingOb[playerid] = 255;
	PlayerInfo[playerid][God] = 0;
	PlayerInfo[playerid][Hidden] = 0;
	PlayerInfo[playerid][ObjectStatus] = 0;
	PlayerInfo[playerid][AutoFix] = 0;
	PlayerInfo[playerid][MyTime] = 0;
	PlayerInfo[playerid][MyHour] = -1;
	PlayerInfo[playerid][GodCar] = 0;
	PlayerInfo[playerid][TimesSpawned] = 0;
	PlayerInfo[playerid][Muted] = 0;
	PlayerInfo[playerid][MuteWarnings] = 0;
	PlayerInfo[playerid][Warnings] = 0;
	PlayerInfo[playerid][Caps] = 0;
	PlayerInfo[playerid][DoorsLocked] = 0;
	for(new i; i<PING_MAX_EXCEEDS; i++) PlayerInfo[playerid][pPing][i] = 0;
	PlayerInfo[playerid][SpamCount] = 0;
	PlayerInfo[playerid][SpamTime] = 0;
	PlayerInfo[playerid][PingCount] = 0;
	PlayerInfo[playerid][PingTime] = 0;
	PlayerInfo[playerid][FailLogin] = 0;
	PlayerInfo[playerid][DuelX] = 0.0;
 	PlayerInfo[playerid][DuelY] = 0.0;
 	PlayerInfo[playerid][DuelZ] = 0.0;
 	PlayerInfo[playerid][DuelAng] = 0.0;
 	DuelWepz[playerid][0] = -1;
 	DuelWepz[playerid][1] = -1;
 	ChristmasPlay[playerid] = 0;
 	StreamID[playerid] = 0;
 	pGame[playerid] = 0;
 	vObject[playerid] = -1;
 	AdminWorld[playerid] = 0;
 	PlayerInfo[playerid][DuelTo] = INVALID_PLAYER_ID;
 	PlayerInfo[playerid][DuelFrom] = INVALID_PLAYER_ID;
 	PlayerInfo[playerid][IsInDuel] = 0;
	PlayerInfo[playerid][ConnectTime] = gettime();

    ApplyAnimation(playerid,"DANCING","DNCE_M_E",4.0,1,0,0,0,-1); // Preloading the class animation
	//------------------------------------------------------
	new PlayerName[MAX_PLAYER_NAME], string[128], str[128];
	GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
	new tmp3[50]; GetPlayerIp(playerid,tmp3,50);
	//-----------------------------------------------------
	printf("[IP]: %s - [HWID]: %s", tmp3, GetPlayerSerial(playerid));
	if(ServerInfo[ConnectMessages] == 1)
	{
	    new pAKA[256]; pAKA = dini_Get("lsx/config/aka.txt",tmp3);
		if (strlen(pAKA) < 3)
		{
			format(str,sizeof(str),"*** %s (%d) has connected to Los Santos Xtreme", PlayerName, playerid);
		}
		else if (!strcmp(pAKA,PlayerName,true))
		{
			format(str,sizeof(str),"*** %s (%d) has connected to Los Santos Xtreme", PlayerName, playerid);
		}
		else
		{
		    for(new i = 0; i < MAX_PLAYERS; i++)
			{
				if(IsPlayerConnected(i) && playerid != i)
				{
				    if(PlayerInfo[i][Level] > 1)
				    {
				    	format(str,sizeof(str),"*** %s (%d) has connected to Los Santos Xtreme (aka %s)", PlayerName, playerid, pAKA );
						SendClientMessage(i,grey,str);
					}
					else
					{
						format(string,sizeof(string),"*** %s (%d) has connected to Los Santos Xtreme", PlayerName, playerid);
			 			SendClientMessage(i,grey,string);
					}
				}
			}
		}
	}
	//-----------------------------------------------------
    if (dUserINT(PlayerName2(playerid)).("banned") == 1)
    {
        SendClientMessage(playerid, red, "This account is banned from this server!");
		format(string,sizeof(string),"%s ID:%d was auto kicked. Reason: Name banned from server",PlayerName,playerid);
		SendClientMessageToAll(grey, string);  print(string);
		SaveToFile("KickLog",string);  Kick(playerid);
    }
	//-----------------------------------------------------
	if(ServerInfo[NameKick] == 1)
	{
		for(new s = 0; s < BadNameCount; s++)
		{
  			if(!strcmp(BadNames[s],PlayerName,true))
  			{
				SendClientMessage(playerid,red, "Your name is on our black list, you have been kicked.");
				format(string,sizeof(string),"%s ID:%d was auto kicked. (Reason: Forbidden name)",PlayerName,playerid);
				SendClientMessageToAll(grey, string);  print(string);
				SaveToFile("KickLog",string);  Kick(playerid);
				return 1;
			}
		}
	}
	//-----------------------------------------------------
	if(ServerInfo[PartNameKick] == 1)
	{
		for(new s = 0; s < BadPartNameCount; s++)
		{
			new pos;
			while((pos = strfind(PlayerName,BadPartNames[s],true)) != -1) for(new i = pos, j = pos + strlen(BadPartNames[s]); i < j; i++)
			{
				format(string,sizeof(string),"%s ID:%d was auto kicked. (Reason: Clantag is banned)",PlayerName,playerid);
				SendClientMessage(playerid,red, "Your Clantag is not allowed on this server, you have been kicked.");
				SendClientMessageToAll(grey, string);  print(string);
				SaveToFile("KickLog",string);  Kick(playerid);
				return 1;
			}
		}
	}
	//-----------------------------------------------------
	if(ServerInfo[Locked] == 1)
	{
		PlayerInfo[playerid][AllowedIn] = false;
		SendClientMessage(playerid,red,"Server is Locked!  You have 20 seconds to enter the server password before you are kicked!");
		SendClientMessage(playerid,red," Type /password [password]");
		LockKickTimer[playerid] = SetTimerEx("AutoKick", 20000, 0, "i", playerid);
	}
	//-----------------------------------------------------
	if(strlen(dini_Get("lsx/config/aka.txt", tmp3)) == 0) dini_Set("lsx/config/aka.txt", tmp3, PlayerName);
 	else
	{
	    if( strfind( dini_Get("lsx/config/aka.txt", tmp3), PlayerName, true) == -1 )
		{
		    format(string,sizeof(string),"%s,%s", dini_Get("lsx/config/aka.txt",tmp3), PlayerName);
		    dini_Set("lsx/config/aka.txt", tmp3, string);
		}
	}
	//-----------------------------------------------------
	if(!udb_Exists(PlayerName2(playerid)) && IsPlayerNPC(playerid))
	{
 		PlayerInfo[playerid][LoggedIn] = 1;
        PlayerInfo[playerid][Registered] = 1;
        PlayerInfo[playerid][Licence] = 1;
        NewbieSpawnDone[playerid] = 1;
		return 1;
	}
	else if(!udb_Exists(PlayerName2(playerid)) && !IsPlayerNPC(playerid))
	{
        SendClientMessage(playerid,orange, "PlayLSX: Type /register [password] to create an account");
 		NewbieSpawnDone[playerid] = 0;
		return 1;
	}
	else
	{
	    NewbieSpawnDone[playerid] = 1;
        //TogglePlayerSpectating(playerid, 1);
	    PlayerInfo[playerid][Registered] = 1;
/*		format(file,sizeof(file),"/lsx/users/%s.sav",udb_encode(PlayerName));
		new tmp2[256]; tmp2 = dini_Get(file,"ip");
		if( (!strcmp(tmp3,tmp2,true)) && (ServerInfo[AutoLogin] == 1) )
		{
			LoginPlayer(playerid);
			PlayerInfo[playerid][LoggedIn] = 1;
			//TogglePlayerSpectating(playerid, 0);

			if(PlayerInfo[playerid][Level] > 0)
			{
				format(string,sizeof(string),"PlayLSX: You have been automatically logged in. (Level %d)", PlayerInfo[playerid][Level] );
				SendClientMessage(playerid,MANAGEMENT,string);
				LoginPlayer(playerid);
       		}
	   		else SendClientMessage(playerid,MANAGEMENT,"PlayLSX: You have been automatically logged in.");
  	    } */
	}
    InStadium[playerid] = 0;
    InVipRoom[playerid] = 0;

    PlayerTaxi[playerid] = 0;
    IsAtTune[playerid] = 0;
    Basejumper[playerid] = 0;
    SpawnArmourBought[playerid] = 0;
    IsSuicidal[playerid] = 0;
    gangInvite[playerid]= 0;
    playerGang[playerid]=0;
    Vallow[playerid] = 0;
    TeleBan[playerid] = 0;
    playerCheckpoint[playerid]=999;
	Spawned2[playerid] = 0;
    CurrentCCTV[playerid] = -1;

    // ----------- property system ------------------------------------------ //
    PlayerProps[playerid] = 0;
    Logged[playerid] = 0;
    EarningsForPlayer[playerid] = 0;
	new pName2[MAX_PLAYER_NAME];
	GetPlayerName(playerid, pName2, MAX_PLAYER_NAME);
	for(new propid; propid < PropertiesAmount; propid++)
	{
		if(PropInfo[propid][PropIsBought] == 1)
		{
		    if(strcmp(PropInfo[propid][PropOwner], pName2, true)==0)
			{
			    EarningsForPlayer[playerid] += PropInfo[propid][PropEarning];
			    PlayerProps[playerid]++;
			}
		}
	}
	//------------------------------------------------------------------------//
	SetMapIcons(playerid);
    IsPlayerDed[playerid] = 0;
	PlayerTaxi[playerid] = 0;
	
	// Level Textdraw Test
	LevelText[playerid] = TextDrawCreate(502.000000,8.000000,"--.--");
	TextDrawAlignment(LevelText[playerid],0);
	TextDrawBackgroundColor(LevelText[playerid],0xffffff33);
	TextDrawFont(LevelText[playerid],1);
	TextDrawLetterSize(LevelText[playerid],0.399999,1.100000);
	TextDrawColor(LevelText[playerid],0x000000ff);
	TextDrawSetOutline(LevelText[playerid],1);
	TextDrawSetProportional(LevelText[playerid],1);

	SetTimerEx("AFKick", AFK_TIME*60*1000, true, "i", playerid); // AFK Check
	ShipTimer = SetTimerEx("PlayerOnShip",3000,true,"i",playerid);
	format(str, sizeof(str), "      ~y~LSX v"#LVXVersion" ~n~~r~~h~~h~~<~~b~Ben Ravetta~r~~h~~h~~>~");
	GameTextForPlayer(playerid,str,5000, 4);

    if(!udb_Exists(PlayerName2(playerid)))
    {
		SendClientMessage(playerid,Green,"-----------------------------------------------------------------------------");
		format(str, sizeof(str)," *** Welcome to Los Santos Xtreme "#LVXVersion" Beta testing (Phase 2) ***");
		SendClientMessage(playerid,LightBlue,str);
    	SendClientMessage(playerid,Green,"-----------------------------------------------------------------------------");
    	SendClientMessage(playerid,ColorSystem,"For help read /help.");
    	SendClientMessage(playerid,ColorSystem,"To see the available commands for you, type /commands.");
	}
	else
	{
	    SendClientMessage(playerid,Green,"-----------------------------------------------------------------------------");
		#if BETA_BUILD == 1
		format(str, sizeof(str),"Welcome back %s | "#LVXVersion" Beta Testing (Phase 2) ***", PlayerName2(playerid));
		#elseif BETA_BUILD == 0
		format(str, sizeof(str), "Welcome back to Los Santos Xtreme %s!", pName(playerid));
		#endif

		SendClientMessage(playerid,LightBlue,str);
    	SendClientMessage(playerid,Green,"-----------------------------------------------------------------------------");
    	SendClientMessage(playerid,ColorSystem,"Enjoy your stay with us today!");
	}
    gActivePlayers[playerid]++;
	gLastGaveCash[playerid] = GetTickCount();
	PlayerTp[playerid]=0;PlayerCtp[playerid]=0;PlayerDive[playerid]=0;PlayerCardive[playerid]=0;PlayerGivecash[playerid]=0;

	if(!Audio_IsClientConnected(playerid))
	{
	    SendClientMessage(playerid, COLOR_WHITE, "We have determined you do not have the audio plug-in installed,");
	    SendClientMessage(playerid, COLOR_WHITE, "until you do, you will not experience any of Los Santos Xtremes custom sounds.");
	}
	
    SendDeathMessage(playerid, INVALID_PLAYER_ID, 200);
    
	#if IRC_ENABLED == 1
	new joinMsg[128];
	format(joinMsg, sizeof(joinMsg), "02[%d] 03*** %s has joined the server.", playerid, pName(playerid));
	AddEcho(joinMsg);
	#endif
	//------------------------------------------------------------------------//
    return 1;
}

//==============================================================================

forward AutoKick(playerid);
public AutoKick(playerid)
{
	if( IsPlayerConnected(playerid) && ServerInfo[Locked] == 1 && PlayerInfo[playerid][AllowedIn] == false) {
		new string[128];
		SendClientMessage(playerid,grey,"You have been automatically kicked. Reason: Server Locked");
		format(string,sizeof(string),"%s ID:%d has been automatically kicked. Reason: Server Locked",PlayerName2(playerid),playerid);
		SaveToFile("KickLog",string);  Kick(playerid);
		SendClientMessageToAll(grey, string); print(string);
	}
	return 1;
}

new lastupdate[MAX_PLAYERS]; // Escape menu variable.

public OnPlayerUpdate(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;

	lastupdate[playerid] = GetTickCount();
	if(IsPlayerPaused(playerid) && PauseTag[playerid] == 0)
	{
		new Float:X, Float:Y, Float:Z;
		GetPlayerPos(playerid, X, Y, Z);
	    pTag[playerid] = Create3DTextLabel("Idling", GetPlayerColor(playerid), X, Y, Z+0.3, 40, GetPlayerVirtualWorld(playerid));
		Attach3DTextLabelToPlayer(pTag[playerid], playerid, X, Y, Z+0.3);
		PauseTag[playerid] = 1;
	}
	if(PauseTag[playerid] == 1)
	{
	    Delete3DTextLabel(pTag[playerid]);
	    PauseTag[playerid] = 0;
	}
	if(GetPlayerInterior(playerid) != 0 && GetPlayerWeapon(playerid) != 0)
	{
	    SetPlayerArmedWeapon(playerid,0); // fists
	    return 1; // no syncing until they change their weapon
	}
	return 1;
}

//==============================================================================

public OnPlayerDisconnect(playerid, reason)
{
	new PlayerName[MAX_PLAYER_NAME], str[128], file[128], reasonMsg[128];
	GetPlayerName(playerid, PlayerName, sizeof(PlayerName));

	if(ServerInfo[ConnectMessages] == 1)
	{
		switch(reason)
		{
			case 0:
			{
				reasonMsg = "Connection Interrupted";
			}
			case 1:
			{
			    format(file,sizeof(file),"/lsx/users/%s.sav",udb_encode(PlayerName2(playerid)));
			    if(strlen(dini_Get(file,"CustomMsgLeave")) > 1)
			    {
			        new CustomMsg[128];
			        format(CustomMsg, sizeof(CustomMsg), "%s", dini_Get(file,"CustomMsgLeave"));
					reasonMsg = CustomMsg;
				}
				else
				{
				    reasonMsg = "Disconnecting";
				}
			}
			case 2:
			{
				reasonMsg = "Kicked";
			}
		}
		format(str, sizeof(str), "*** %s (%d) has left Los Santos Xtreme (%s)", pName(playerid), playerid, reasonMsg);
		SendClientMessageToAll(Gray, str);
		#if BETA_BUILD == 1
		printf("DEBUG: %s", str);
		#endif
		#if IRC_ENABLED == 1
		new leaveMsg[128];
		format(leaveMsg, sizeof(leaveMsg), "02[%d] 03*** %s has left the server. (%s)", playerid, pName(playerid), reasonMsg);
		AddEcho(leaveMsg);
		#endif
	}

	if(PlayerInfo[playerid][LoggedIn] == 1)	SavePlayer(playerid);
	if(udb_Exists(PlayerName2(playerid))) dUserSetINT(PlayerName2(playerid)).("LoggedIn",0);
	PlayerInfo[playerid][Deaths] = 0;
	PlayerInfo[playerid][PlayerDynCar] = -1;
	PlayerInfo[playerid][Kills] = 0;
	PlayerInfo[playerid][Jailed] = 0;
	PlayerInfo[playerid][Frozen] = 0;
	PlayerInfo[playerid][TotalTime] = 0;
	PlayerInfo[playerid][TeleMsg] = 0;
	PlayerInfo[playerid][Level] = 0;
	PlayerInfo[playerid][FavSkin] = -1;
	PlayerInfo[playerid][Temped] = 0;
	PlayerInfo[playerid][LoggedIn] = 0;
	PlayerInfo[playerid][Registered] = 0;
	PlayerInfo[playerid][Cookies] = 0;
	PlayerInfo[playerid][HoldingObject] = 255;
	CurrentHoldingOb[playerid] = 255;
	PlayerInfo[playerid][God] = 0;
	PlayerInfo[playerid][Hidden] = 0;
	PlayerInfo[playerid][ObjectStatus] = 0;
	PlayerInfo[playerid][AutoFix] = 0;
	PlayerInfo[playerid][MyTime] = 0;
	PlayerInfo[playerid][MyHour] = -1;
	PlayerInfo[playerid][GodCar] = 0;
	PlayerInfo[playerid][TimesSpawned] = 0;
	PlayerInfo[playerid][Muted] = 0;
	PlayerInfo[playerid][MuteWarnings] = 0;
	PlayerInfo[playerid][Warnings] = 0;
	PlayerInfo[playerid][Caps] = 0;
	PlayerInfo[playerid][DoorsLocked] = 0;
	for(new i; i<PING_MAX_EXCEEDS; i++) PlayerInfo[playerid][pPing][i] = 0;
	PlayerInfo[playerid][SpamCount] = 0;
	PlayerInfo[playerid][SpamTime] = 0;
	PlayerInfo[playerid][PingCount] = 0;
	PlayerInfo[playerid][PingTime] = 0;
	PlayerInfo[playerid][FailLogin] = 0;
	PlayerInfo[playerid][DuelX] = 0.0;
 	PlayerInfo[playerid][DuelY] = 0.0;
 	PlayerInfo[playerid][DuelZ] = 0.0;
 	PlayerInfo[playerid][DuelAng] = 0.0;
 	DuelWepz[playerid][0] = -1;
 	DuelWepz[playerid][1] = -1;
 	ChristmasPlay[playerid] = 0;
 	StreamID[playerid] = 0;
 	pGame[playerid] = 0;
 	vObject[playerid] = -1;
 	PlayerInfo[playerid][DuelTo] = INVALID_PLAYER_ID;
 	PlayerInfo[playerid][DuelFrom] = INVALID_PLAYER_ID;
 	PlayerInfo[playerid][IsInDuel] = 0;
	PlayerInfo[playerid][ConnectTime] = 0;

	if(PlayerInfo[playerid][Jailed] == 1) KillTimer( JailTimer[playerid] );
	if(PlayerInfo[playerid][Frozen] == 1) KillTimer( FreezeTimer[playerid] );
	if(ServerInfo[Locked] == 1)	KillTimer( LockKickTimer[playerid] );

	if(PlayerInfo[playerid][PlayerDynCar] != -1) CarDeleter(PlayerInfo[playerid][PlayerDynCar]);

    PlayerTaxi[playerid]=0;
    IsPlayerDed[playerid] = 0;
    if(playerGang[playerid] > 0)
	{
    	PlayerLeaveGang(playerid);
	}
	TextDrawHideForPlayer(playerid, Clock);
	TextDrawHideForPlayer(playerid,WebUrl);
	TextDrawHideForPlayer(playerid, LevelText[playerid]);

	PlayerTp[playerid]=0;PlayerCtp[playerid]=0;PlayerDive[playerid]=0;PlayerCardive[playerid]=0;PlayerGivecash[playerid]=0;

	new WasInCar = IsPlayerInAnyVehicle(playerid); // Was nerd in a car?
	if(WasInCar) {
		new WhatCar = GetPlayerVehicleID(playerid); // If so .. get the vehicle id ..
		SetVehicleToRespawn(WhatCar); // and re-fucking-spawn that badboy.
		                              // Because driving into empty cars
		                              // in the middle of the road gets REALLY FUCKING ANNOYING!!!!!!11 -.-
	}

	if(CurrentCCTV[playerid] > -1)
	{
	    KillTimer(KeyTimer[playerid]);
	    TextDrawHideForPlayer(playerid, TD);
	}
	CurrentCCTV[playerid] = -1;

    SendDeathMessage(playerid, INVALID_PLAYER_ID, 201);

 	return 1;
}

forward DelayKillPlayer(playerid);
public DelayKillPlayer(playerid)
{
	SetPlayerHealth(playerid,0.0);
	ForceClassSelection(playerid);
}

forward KillPlayer(playerid);
public KillPlayer(playerid)
{
	SetPlayerHealth(playerid,0.0);
}

public AdminColorHax(playerid)
{
    if(PlayerInfo[playerid][Level] == 2)
	{
        SetPlayerColor(playerid,MOD);
        KillTimer(AdColor);
    }
	if(PlayerInfo[playerid][Level] > 2 && PlayerInfo[playerid][Level] < 5)
	{
		SetPlayerColor(playerid,DAYTONA_YELLOW);
		KillTimer(AdColor);
	}
	if(PlayerInfo[playerid][Level] >= 5)
	{
		SetPlayerColor(playerid,MANAGEMENT);
		KillTimer(AdColor);
	}
	if(PlayerInfo[playerid][Level] == 1338)
	{
		SetPlayerColor(playerid,JEROME);
		KillTimer(AdColor);
	}
//    else
//   {}

    return 1;
}

forward SendKickMsg(playerid, const string[]);
public SendKickMsg(playerid, const string[])
{
    for(new j = 0; j < 70; j++) SendClientMessage(playerid,Green," ");
    SendClientMessage(playerid,White,"------------------------------------------");
	SendClientMessage(playerid,Red, string);
	SendClientMessage(playerid,White,"------------------------------------------");
	TogglePlayerControllable(playerid,false);
	SetPlayerWeather(playerid,8);
	return 1;
}

forward SendBanMsg(playerid, staffid, const string[]);
public SendBanMsg(playerid, staffid, const string[])
{
    for(new j = 0; j < 70; j++) SendClientMessage(playerid,Green," ");
    new istring[128];
	SendClientMessage(playerid,White,"------------------------------------------");
	format(istring, sizeof(istring), "You have been banned from Los Santos Xtreme for: %s", string);
	SendClientMessage(playerid,Red, istring);
	SendClientMessage(playerid,Red, "If you don't think this is correct, make an appeal at our forums or come and visit us on IRC.");
    SendClientMessage(playerid,White,"------------------------------------------");
	if(staffid != playerid)
	{
	    format(istring, sizeof(istring), "Authorized by: {FFFFFF}%s", pName(staffid));
	    SendClientMessage(playerid,Red, istring);
	}
	else
	{
	    SendClientMessage(playerid,Red, "Authorized by: {FFFFFF}Autoban");
	}
	format(istring, sizeof(istring), "Forums: %s", URL_STRING); SendClientMessage(playerid,Red, istring);
	format(istring, sizeof(istring), "IRC: %s: %d || Channel: %s", IRC_SERVER, IRC_PORT, IRC_CHANNEL); SendClientMessage(playerid,Red, istring);
	format(istring, sizeof(istring), "Thankyou for playing on %s", SERVER_NAME); SendClientMessage(playerid,Red, istring);
	SendClientMessage(playerid,White,"------------------------------------------");
	TogglePlayerControllable(playerid,false);
	SetPlayerWeather(playerid,8);
	return 1;
}

public RandomColorsTimer(playerid)
{
	new rcolors=random(sizeof(RandomColors));
    if(PlayerInfo[playerid][Registered] != 1)
	{
 		SetPlayerColor(playerid, White);
	}
	else if(PlayerInfo[playerid][Registered] >= 1 && PlayerInfo[playerid][SpawnColour] == 255)
	{
		SetPlayerColor(playerid,RandomColors[rcolors]);
	}
	else if(PlayerInfo[playerid][Registered] >= 1 && PlayerInfo[playerid][Level] >= 0 && PlayerInfo[playerid][SpawnColour] != 255)
	{
	    SetPlayerColor(playerid, PlayerInfo[playerid][SpawnColour]);
	}
    KillTimer(RColor);
    return 1;
}

//==============================================================================
public OnPlayerSpawn(playerid)
{
	ResetPlayerWeapons(playerid); // Take away all their weapons. The spawn timer will sort the rest out.

    if(PlayerInfo[playerid][Regular] == 0)
	{
		SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 200);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, 200);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, 200);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, 200);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 200);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, 200);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 200);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, 200);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, 200);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, 200);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_SNIPERRIFLE, 200);
    }
	else
	{
        SetPlayerFightingStyle(playerid, FIGHT_STYLE_BOXING);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 999);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, 999);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, 999);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, 999);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 999);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, 999);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 999);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, 999);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, 999);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, 999);
        SetPlayerSkillLevel(playerid, WEAPONSKILL_SNIPERRIFLE, 999);
	}

	if(PlayerInfo[playerid][Registered] == 1)
	{
	    if(PlayerInfo[playerid][LoggedIn] == 1)
	    {
	        if(PlayerInfo[playerid][HoldingObject] != 255)
	        {
	            if(PlayerInfo[playerid][ObjectStatus] == 1)
	            {
	                new Index = CalculatePlayerObjectSlot(playerid);
	                if(Index != INVALID_OBJECT_SLOT)
	                {
	                	SetPlayerAttachedObject(playerid, Index, dUserINT(PlayerName2(playerid)).("HObjID"), dUserINT(PlayerName2(playerid)).("Bone"), dUserFLOAT(PlayerName2(playerid)).("HObjXoff"), dUserFLOAT(PlayerName2(playerid)).("HObjYoff"), dUserFLOAT(PlayerName2(playerid)).("HObjZoff"), dUserFLOAT(PlayerName2(playerid)).("HObjXrot"), dUserFLOAT(PlayerName2(playerid)).("HObjYrot"), dUserFLOAT(PlayerName2(playerid)).("HObjZrot"));
					}
					else
					{
					    SendClientMessage(playerid, Red, "ERROR: You have maxed out your object slots, please remove an item before continuing.");
					}
				}
			}
		}
	}
	if(WantedGameOn == 1)
	{
		for(new i=0; i<MAX_PLAYERS; i++)
		{
			if(GetPlayerVehicleID(i) != WantedCar)
			{
			    new Float:X, Float:Y, Float:Z;
        		GetVehiclePos(WantedCar, X, Y, Z);
        		SetPlayerMapIcon(i, 6, X, Y, Z, 55, MAPICON_GLOBAL);
			}
  		}
	}

	if(ServerInfo[Locked] == 1 && PlayerInfo[playerid][AllowedIn] == false)
	{
		GameTextForPlayer(playerid,"~r~Server Locked~n~You must enter password before spawning~n~/password <password>",4000,3);
		SetTimerEx("DelayKillPlayer", 2500,0,"d",playerid);
		return 1;
	}
    Spawned2[playerid] = 1;
	PlayerInfo[playerid][Spawned] = 1;

	if(PlayerInfo[playerid][Frozen] == 1) {
		TogglePlayerControllable(playerid,false); return SendClientMessage(playerid,red,"You cant escape your punishment. You Are Still Frozen");
	}

	if(PlayerInfo[playerid][Jailed] == 1)
	{
	    PlayerInfo[playerid][JailTime] = PlayerInfo[playerid][JailTime]*2;
	    SetTimerEx("JailPlayer",100,0,"d",playerid); return SendClientMessage(playerid,red,"You cant escape your punishment. You Are Still In Jail");
	}
	
	if(ServerInfo[AdminOnlySkins] == 1) {
		if( (GetPlayerSkin(playerid) == ServerInfo[AdminSkin]) || (GetPlayerSkin(playerid) == ServerInfo[AdminSkin2]) ) {
			if(PlayerInfo[playerid][Level] >= 1)
				SetPlayerHealth(playerid,150.0);
			else {
				GameTextForPlayer(playerid,"~r~This Skin Is For~n~Administrators~n~Only",4000,1);
				SetTimerEx("DelayKillPlayer", 2500,0,"d",playerid);
				return 1;
			}
		}
	}

	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
		if(dUserINT(pName(playerid)).("FavSkin") != -1)
		{
			SetPlayerSkin(playerid,PlayerInfo[playerid][FavSkin]);
		}
	}

	if(PlayerInfo[playerid][Registered] == 0 && NewbieSpawnDone[playerid] == 0)
	{
	    SetPosAndAngle(playerid, 2510.4536,-1469.4739,24.0254,267.9257);
	    ClearChat(playerid);
	    SendClientMessage(playerid, DAYTONA_YELLOW, "---------------------------------------------");
	    SendClientMessage(playerid, DAYTONA_YELLOW, "You have spawned here because you're new to LSX!");
	    SendClientMessage(playerid, DAYTONA_YELLOW, "Here can find some basic rules and some weapon pickups to get you started!");
	    SendClientMessage(playerid, DAYTONA_YELLOW, "You will probably never spawn here again after this time, so make sure you remember the rules.");
	    SendClientMessage(playerid, DAYTONA_YELLOW, "If you have any problems, please contact an Administrator with '@Help I'm having a problem'");
	    SendClientMessage(playerid, DAYTONA_YELLOW, "Once again, welcome to Los Santos Xtreme, we hope you enjoy our server.");
        SendClientMessage(playerid, DAYTONA_YELLOW, "---------------------------------------------");
		SetPlayerHealth(playerid, 99999);
		NewbieSpawnDone[playerid] = 0;
		SendClientMessage(playerid, MANAGEMENT, "* You are now protected for one minute.");
		SetTimerEx("NewbieGodMode", 60000, 0, "i", playerid);
	}
	else if(AdminWorld[playerid] != 0)
	{
	    if(AdminWorld[playerid] == 1)
	    {
	        SetPosAndAngle(playerid,-6056.30078125,1674.03491211,3.42434609,180);
	        InitObjsForPlayer(playerid);
	        SendClientMessage(playerid, White, "You have been respawned at BASE1 {5f7c3d}(Endgame Code: B1)");
            SetPlayerVirtualWorld(playerid, 311287);
		}
		else if(AdminWorld[playerid] == 2)
		{
            SetPosAndAngle(playerid, 414.4385,2532.2263,19.1514,90.3141);
	        SendClientMessage(playerid, MANAGEMENT, "You have been respawned at Administration Headquarters.");
			InitObjsForPlayer(playerid);
		}
		else if(AdminWorld[playerid] == 3)
		{
		    SetPosAndAngle(playerid, 775.7128,-2852.9648,5.6095,3.2828);
		    InitObjsForPlayer(playerid);
			SetPlayerVirtualWorld(playerid, 311287);
 			SendClientMessage(playerid, MANAGEMENT, "You have been respawned at the Administration Island. Use /ahq2 again to get back.");
		}
		else if(AdminWorld[playerid] == 4)
		{
		    SetPosAndAngle(playerid, 4016.3882,232.4640,20.9957, 201);
			InitObjsForPlayer(playerid);
			SendClientMessage(playerid, White, "You have been respawned at {5f7c3d}PhiBon Island. (Admin Virtual World)");
			SetPlayerVirtualWorld(playerid, 311287);
		}
	}
	else
	{
	    NewbieSpawnDone[playerid] = 1;
		SetPlayerRandomSpawn(playerid);
	}
	new cash = GetPlayerMoney(playerid);
	if(cash < 2500 && cash > -1) {
	    GivePlayerMoney(playerid,POCKET_DOSH);
	}
	SetPlayerHealth(playerid,100000); // Critical - DO NOT remove.
	IsSpawning[playerid] = 1;
	if(NewbieSpawnDone[playerid] > 0)
	{
		SetTimerEx("SpawnTimer",10000,false,"i",playerid);
	}
	TextDrawHideForPlayer(playerid,test);
	IsPlayerDed[playerid] = 0;
	SetPlayerInterior(playerid,0);
	TextDrawShowForPlayer(playerid, Clock);
	TextDrawShowForPlayer(playerid, WebUrl);
//	TextDrawShowForPlayer(playerid, WeekDayg);
	if(PlayerInfo[playerid][Level] == 0)
	{
	    TextDrawSetString(LevelText[playerid], "LSX Player");
	}
	else if(PlayerInfo[playerid][Level] == 1)
	{
	    TextDrawSetString(LevelText[playerid], "] V.I.P ]");
	}
	else if(PlayerInfo[playerid][Level] == 2)
	{
	    TextDrawSetString(LevelText[playerid], "Moderator");
	}
	else if(PlayerInfo[playerid][Level] == 3)
	{
	    TextDrawSetString(LevelText[playerid], "Junior Admin");
	}
	else if(PlayerInfo[playerid][Level] == 4)
	{
	    TextDrawSetString(LevelText[playerid], "Senior Admin");
	}
	else if(PlayerInfo[playerid][Level] >= 5 && PlayerInfo[playerid][Level] < 1338)
	{
	    TextDrawSetString(LevelText[playerid], "Management");
	}
	else if(PlayerInfo[playerid][Level] == 1338)
	{
	    TextDrawSetString(LevelText[playerid], "LSX Founder");
	}

	if(IsGameOn) return SetPlayerColor(playerid,MAD_WHITE);

	#if CONNECT_BOTS == 1
	if(IsPlayerNPC(playerid))
    {
        new npcname[MAX_PLAYER_NAME];
    	GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
    	if(!strcmp(npcname, "PoliceChopper", true))
    	{
    		PutPlayerInVehicle(playerid, NPCPoliceHeli, 0); //Putting the NPC into the vehicle we created for it.
    	}
    	if(!strcmp(npcname, "Black_Ops_1", true))
    	{
    		PutPlayerInVehicle(playerid, BlackOpsHeli_1, 0);
    	}
    	if(!strcmp(npcname, "The_Watcher", true))
    	{
    		PutPlayerInVehicle(playerid, BlackOpsRancher, 0);
		}
    }
	#endif
	return 1;
}

//---------------------------
forward SetPlayerInLoginRoom(playerid);
public SetPlayerInLoginRoom(playerid)
{
	if(IsPlayerNPC(playerid)) return 1;
	SetPosAndAngle(playerid, -794.8814,490.5234,1376.1953,0.6498);
	SetPlayerSkin(playerid,(dUserINT(PlayerName2(playerid)).("FavSkin")) );
	SetPlayerInterior(playerid, 1);
	SetCameraBehindPlayer(playerid);
	TogglePlayerControllable(playerid, false);
	ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT,"Login to your account", "Please enter the password to your account into\n the box below and press enter.", "Login", "Cancel");
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(IsPlayerNPC(playerid)) return 1;

    if(dialogid == LOGIN)
    {
        if(!response)
		{
		    new string[128];
		    format(string,sizeof(string), "* %s has been kicked from LSX (Cancelled Login)", pName(playerid));
			SendClientMessageToAll(COLOR_ORANGE, string);
		 	return Kick(playerid);
		}
		else if (udb_CheckLogin(PlayerName2(playerid),inputtext))
		{
			new file[128], tmp3[100], string[128], string2[254], string3[254];
			format(file,sizeof(file),"/lsx/users/%s.sav",udb_encode(PlayerName2(playerid)) );
			GetPlayerIp(playerid,tmp3,100);
			dini_Set(file,"ip",tmp3);
			LoginPlayer(playerid);
			TogglePlayerSpectating(playerid, 0);
			TogglePlayerControllable(playerid, 1);
 			SpawnPlayer(playerid);
  			Spawned2[playerid] = 1;
  			//OnPlayerRequestSpawn(playerid);
			#if IRC_ENABLED == 1
 			new istr[128];
			format(istr,sizeof(istr),"4[%d]3%s has logged in.",playerid, PlayerName2(playerid));
			IRC_GroupSay(gGroupID, CREW_CHAN, istr);
			AddEcho(istr);
			#endif

			if(PlayerInfo[playerid][Level] > 1)
			{
				format(string,sizeof(string),"PlayLSX: Successfully Logged In. (Level %d)", PlayerInfo[playerid][Level] );
 				format(string2,sizeof(string2),"%s has logged in. (Level %d)",PlayerName2(playerid),PlayerInfo[playerid][Level] );
 				SendClientMessage(playerid,MANAGEMENT,string);
 				TextDrawSetString(test,string2);
 				TextDrawForAdmins(playerid, test);
 				Vallow[playerid] = 1;
 				AdColor=SetTimerEx("AdminColorHax",1500,false,"i",playerid);
				SetTimerEx("HideTextDrawForAdmin",3000,false,"i",playerid);
			}
			else if(PlayerInfo[playerid][Level] < 2 && PlayerInfo[playerid][Level] > 0)
			{
 				format(string,sizeof(string),"PlayLSX: Welcome back %s. Your login was successful. Account status (VIP)", PlayerName2(playerid));
				SendClientMessage(playerid,MANAGEMENT,string);
 				format(string3,sizeof(string3),"%s has logged in. (VIP)",PlayerName2(playerid));
 				TextDrawSetString(test,string3);
				TextDrawForAdmins(playerid, test);
				SetTimerEx("HideTextDrawForAdmin",3000,true,"i",playerid);
			}
			else if(PlayerInfo[playerid][Level] < 1)
			{
 				format(string,sizeof(string),"PlayLSX: Login successful. Welcome back %s", PlayerName2(playerid));
 				SendClientMessage(playerid,MANAGEMENT,string);
				format(string3,sizeof(string3),"%s has logged in.",PlayerName2(playerid));
 				TextDrawSetString(test,string3);
				TextDrawForAdmins(playerid, test);
				SetTimerEx("HideTextDrawForAdmin",3000,true,"i",playerid);
			}
		}
		else
		{
			PlayerInfo[playerid][FailLogin]++;
			ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT,"Login to your account", "Please enter the password to your account into\n the box below and press enter.", "Login", "Cancel");
			printf("PlayLSX: %s has failed to login, Wrong password (%s) Attempt (%d)", PlayerName2(playerid), inputtext, PlayerInfo[playerid][FailLogin] );
			if(PlayerInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
			{
				new string[128]; format(string, sizeof(string), "%s has been kicked (Wrong Password)", PlayerName2(playerid) );
				SendClientMessageToAll(grey, string);
				#if defined IRC_ON_PLZ
				ircSay(EchoConnection, EchoChan, string);
  				ircSay(EchoConnection, CrewChan, string);
  				#endif
				print(string);
				Kick(playerid);
			}
			return SendClientMessage(playerid,red,"PlayLSX: Login failed! Incorrect Password");
		}
        return 1;
    }
    if(dialogid == DUEL_WEAPONS)
    {
        if(!response)
        {
            PlayerInfo[playerid][DuelTo] = INVALID_PLAYER_ID;
            SendClientMessage(playerid, Red, "* You have cancelled the duel.");
		}
		else
		{
		    if(listitem == 0)
		    {
		        DuelWepz[playerid][0] = 26;
			}
			else if(listitem == 1)
			{
			    DuelWepz[playerid][0] = 34;
			    DuelWepz[playerid][1] = 36;
			}
			ShowPlayerDialog(playerid, DUEL_PLACES, DIALOG_STYLE_LIST, "Select the duel arena you wish to fight in.", "Los Santos Rooftops", "Ok", "Cancel");
		}
	}
	if(dialogid == DUEL_PLACES)
	{
	    if(!response)
	    {
	        DuelWepz[playerid][0] = -1;
	    	DuelWepz[playerid][1] = -1;
            SendClientMessage(playerid, Red, "* You have cancelled the duel.");
		}
		else
		{
		    new string[128], weapon[30], weapon2[30];

		    if(listitem == 0)
		    {
		        PlayerInfo[playerid][DuelX] = 1749.0479;
		        PlayerInfo[playerid][DuelY] = -1134.1736;
		        PlayerInfo[playerid][DuelZ] = 46.5746;
		        PlayerInfo[playerid][DuelAng] = 54.6658;
		        PlayerInfo[PlayerInfo[playerid][DuelTo]][DuelX] = 1713.3606;
		        PlayerInfo[PlayerInfo[playerid][DuelTo]][DuelY] = -1104.9001;
		        PlayerInfo[PlayerInfo[playerid][DuelTo]][DuelZ] = 46.5746;
		        PlayerInfo[PlayerInfo[playerid][DuelTo]][DuelAng] = 228.2541;

		        if(DuelWepz[playerid][1] != -1)
		        {
		            GetWeaponName(DuelWepz[playerid][0],weapon,30);
		            GetWeaponName(DuelWepz[playerid][1],weapon2,30);
		        	format(string, sizeof(string), "* %s has challenged you to a duel with %s & %s at Los Santos Rooftops", pName(playerid), weapon, weapon2);
				}
				else
				{
				    GetWeaponName(DuelWepz[playerid][0],weapon,30);
				    format(string, sizeof(string), "* %s has challenged you to a duel with %s at Los Santos Rooftops", pName(playerid), weapon);
				}
			}
			PlayerInfo[PlayerInfo[playerid][DuelTo]][DuelFrom] = playerid;
			DuelTimeoutTime = SetTimerEx("DuelDialogTimeout", 15000, 0, "i", playerid);
			ShowPlayerDialog(PlayerInfo[playerid][DuelTo], 4, DIALOG_STYLE_MSGBOX, "You have a challenge request", string, "Accept", "Decline");
		}
	}
	if(dialogid == DUEL_DECLINE)
	{
	    if(!response)
	    {
	        new string[128];
	        format(string, sizeof(string), "* %s has declined your challenge request", pName(PlayerInfo[playerid][DuelFrom]));
	        SendClientMessage(PlayerInfo[playerid][DuelFrom], Red, string);
		}
		else
		{
		    KillTimer(DuelTimeoutTime);
		    SetPosAndAngle(playerid,PlayerInfo[playerid][DuelX],PlayerInfo[playerid][DuelY],PlayerInfo[playerid][DuelZ],PlayerInfo[playerid][DuelAng]);
		    SetPosAndAngle(PlayerInfo[playerid][DuelFrom],PlayerInfo[PlayerInfo[playerid][DuelFrom]][DuelX],PlayerInfo[PlayerInfo[playerid][DuelFrom]][DuelY],PlayerInfo[PlayerInfo[playerid][DuelFrom]][DuelZ],PlayerInfo[PlayerInfo[playerid][DuelFrom]][DuelAng]);
			SetPlayerVirtualWorld(PlayerInfo[playerid][DuelFrom], 1000000);
			SetPlayerVirtualWorld(playerid, 1000000);
			ResetPlayerWeapons(playerid);
			ResetPlayerWeapons(PlayerInfo[playerid][DuelFrom]);
			if(DuelWepz[playerid][1] != -1)
            {
				GivePlayerWeapon(PlayerInfo[playerid][DuelFrom],DuelWepz[PlayerInfo[playerid][DuelFrom]][0], 9999);
                GivePlayerWeapon(PlayerInfo[playerid][DuelFrom],DuelWepz[PlayerInfo[playerid][DuelFrom]][1], 9999);
				GivePlayerWeapon(playerid, DuelWepz[PlayerInfo[playerid][DuelFrom]][0], 9999);
				GivePlayerWeapon(playerid, DuelWepz[PlayerInfo[playerid][DuelFrom]][1], 9999);
			}
			else
			{
			    GivePlayerWeapon(PlayerInfo[playerid][DuelFrom],DuelWepz[PlayerInfo[playerid][DuelFrom]][0], 9999);
                GivePlayerWeapon(playerid, DuelWepz[PlayerInfo[playerid][DuelFrom]][0], 9999);
			}
			PlayerInfo[playerid][IsInDuel] = 1;
			PlayerInfo[PlayerInfo[playerid][DuelFrom]][IsInDuel] = 1;
		}
	}
	if(dialogid == JAIL_HELP)
	{
	    if(!response)
	    {
	        SendClientMessage(playerid, Red, "You do not understand? What a shame. More jailtime will help you.");
			PlayerInfo[playerid][JailTime] = PlayerInfo[playerid][JailTime]*2;
			KillTimer(JailTimer[playerid]);
			JailTimer[playerid] = SetTimerEx("JailRelease",PlayerInfo[playerid][JailTime],0,"d",playerid);
		}
		else
		{
		    new string[128];
		    format(string, sizeof(string), "Good, please wait until you are unjailed. You were given %d minutes!",PlayerInfo[playerid][JailTime]/1000/60);
		    SendClientMessage(playerid, MANAGEMENT, string);
		}
	}
	if(dialogid == MYTIME_DIALOG)
	{
	    if(!response)
	    {
	        if(PlayerInfo[playerid][MyHour] == -1)
	        {
	        	PlayerInfo[playerid][MyTime] = 0;
	        	PlayerInfo[playerid][MyHour] = 0;
	        	SendClientMessage(playerid, Red, "Your MyTime setting has been turned off since you did not enter a hour!");
			}
			else
			{
			    SendClientMessage(playerid, MANAGEMENT, "Your hour setting has not been changed.");
			}
		}
		else
		{
		    new string[128];
		    if(IsNumeric(inputtext))
			{
		    	if(strval(inputtext) > -1 || strval(inputtext) < 24)
		    	{
					PlayerInfo[playerid][MyHour] = strval(inputtext);
					format(string, sizeof(string), "You have set your hour to %d. Use /my time to alter.", strval(inputtext));
					SendClientMessage(playerid, MANAGEMENT, string);
				}
				else
				{
				    SendClientMessage(playerid, Red, "ERROR: Time range is between 0 and 23.");
				    ShowPlayerDialog(playerid, MYTIME_DIALOG, DIALOG_STYLE_INPUT, "Set your time!", "Choose an hour of the day to set your personal time to/n this will be saved into your database.", "Ok", "Cancel");
				}
			}
			else
			{
			    SendClientMessage(playerid, Red, "ERROR: Input must be in numeric!");
                ShowPlayerDialog(playerid, MYTIME_DIALOG, DIALOG_STYLE_INPUT, "Set your time!", "Choose an hour of the day to set your personal time to/n this will be saved into your database.", "Ok", "Cancel");
			}
		}
	}
	if(dialogid == LEAVE_MSG_DIALOG_INITIAL)
	{
	    if(!response)
	    {
	        SendClientMessage(playerid, White, "You can choose a custom message anytime you like, just use /my quitmessage");
		}
		else
		{
		    new file[128];
		    if(strlen(inputtext) > 1)
		    {
		        format(file,sizeof(file),"/lsx/users/%s.sav",udb_encode(PlayerName2(playerid)));
			    dini_Set(file, "CustomMsgLeave", inputtext);
			    format(file, sizeof(file), "You have set your quit message to: %s", inputtext);
			    SendClientMessage(playerid, White, file);
			}
			else
			{
				SendClientMessage(playerid, Red, "ERROR: Message MUST be above 1 character.");
			}
		}
	}
	if(dialogid == LEAVE_MSG_DIALOG_EDIT)
	{
	    if(!response)
	    {
	        SendClientMessage(playerid, White, "You can choose a custom message anytime you like, just use /my quitmessage");
		}
		else
		{
		    new file[128];
		    if(strlen(inputtext) > 1)
		    {
		        format(file,sizeof(file),"/lsx/users/%s.sav",udb_encode(PlayerName2(playerid)));
			    dini_Set(file, "CustomMsgLeave", inputtext);
			    format(file, sizeof(file), "You have changed your quit message to: %s", inputtext);
			    SendClientMessage(playerid, White, file);
			}
			else
			{
				SendClientMessage(playerid, Red, "ERROR: Message MUST be above 1 character.");
			}
		}
	}
    return 0;
}

public OnPlayerRequestClass(playerid, classid)
{
	if(IsPlayerNPC(playerid)) return 1;

    if(!udb_Exists(PlayerName2(playerid)))
	{
	    SetTimerEx("SkipSelection",100,0,"i",playerid);
	    //SetPlayerSkin(playerid, 0);
        return 1;
	}
	if(udb_Exists(PlayerName2(playerid)) && PlayerInfo[playerid][LoggedIn] != 1 && dUserINT(PlayerName2(playerid)).("FavSkin") != -1)
	{
        SetTimerEx("SkipSelection",100,0,"i",playerid);
        SetTimerEx("SetPlayerInLoginRoom", 1000, 0, "i", playerid);
        return 1;
	}
/*	if(udb_Exists(PlayerName2(playerid)) && PlayerInfo[playerid][LoggedIn] == 1 && dUserINT(PlayerName2(playerid)).("FavSkin") != 1)
	{
        SetTimerEx("SkipSelection",100,0,"i",playerid);
        return 1;
	}

	if(udb_Exists(PlayerName2(playerid)) && PlayerInfo[playerid][LoggedIn] == 1 && PlayerInfo[playerid][Spawned] == 1 && PlayerInfo[playerid][FavSkin] != 1)
	{
	    SetTimerEx("SkipSelection",100,0,"i",playerid);
	    SendClientMessage(playerid, Red, "** You cannot select a new skin until you unload this one! /dontuseskin");
        return 1;
	}
*/
	else if(udb_Exists(PlayerName2(playerid)) && PlayerInfo[playerid][LoggedIn] == 1)
	{
		SetupPlayerForClassSelection(playerid);
		PlayerInfo[playerid][FavSkin] = GetPlayerSkin(playerid);
		return 1;
	}
	// Setting colours
	RColor=SetTimerEx("RandomColorsTimer",3000,false,"i",playerid);
	return 1;
}

forward SkipSelection(playerid);
public SkipSelection(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;

	SpawnPlayer(playerid);
	return 1;
}

public SetupPlayerForClassSelection(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;

    SetPlayerPos(playerid, 2081.6414,1908.5110,14.4959);
    SetPlayerFacingAngle(playerid, 288.3098);
    SetPlayerCameraPos(playerid, 2087.8677,1911.6936,17.4330);
    SetPlayerCameraLookAt(playerid, 2081.6414,1908.5110,14.4959);
    SetPlayerInterior(playerid,0);
    ApplyAnimation(playerid,"DANCING","DNCE_M_E",4.0,1,0,0,0,-1);
    return 1;
}


public OnPlayerRequestSpawn(playerid)
{
    if(IsPlayerNPC(playerid)) return 1;

    SetPlayerVirtualWorld(playerid, 0);
	if(PlayerInfo[playerid][Level] >= 5)
	{
        new Text3D:Management3D;
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        Management3D = Create3DTextLabel("[Management]", MANAGEMENT, X, Y, Z, 40.0, 0, 1);
		Attach3DTextLabelToPlayer(Management3D,playerid,X, Y, Z+0.3);
		return 1;
	}
	if(PlayerInfo[playerid][Level] >= 3 && PlayerInfo[playerid][Level] < 5)
	{
        new Text3D:Admin3D;
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        Admin3D = Create3DTextLabel("[Admin]", DAYTONA_YELLOW, X, Y, Z, 40.0, 0, 1);
		Attach3DTextLabelToPlayer(Admin3D,playerid,X, Y, Z+0.3);
		return 1;
	}
	if(PlayerInfo[playerid][Level] == 2)
	{
        new Text3D:Moderator3D;
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        Moderator3D = Create3DTextLabel("[Moderator]", MOD, X, Y, Z, 40.0, 0, 1);
		Attach3DTextLabelToPlayer(Moderator3D,playerid,X, Y, Z+0.3);
		return 1;
	}
	if(PlayerInfo[playerid][Level] == 2)
	{
        new Text3D:Donator3D;
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
        Donator3D = Create3DTextLabel("[VIP Member]", MOD, X, Y, Z, 40.0, 0, 1);
		Attach3DTextLabelToPlayer(Donator3D,playerid,X, Y, Z+0.3);
		return 1;
	}

    ClearAnimations(playerid);


	return 1;
}

public OnVehicleDeath(vehicleid)
{
	if(vehicleid == WantedCar)
	{
	    for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(i == Gamecar[i])
            {
          		SendClientMessage(Gamecar[i], Red, ""COL_LIGHTBLUE"DVLA: "COL_WHITE"The impound has charged you for destroying their vehicle!");
				GivePlayerMoney(Gamecar[i], GetPlayerMoney(Gamecar[i])-50000);
				Gamecar[i] = INVALID_PLAYER_ID;
				EndFuckingGame(i);
			}
		}
		SendClientMessageToAll(Red, ""COL_LIGHTBLUE"DVLA: "COL_WHITE"The impound has withdrawn the reward because the vehicle was destroyed!");
	}
	if(DynamicV[vehicleid] == 1)
	{
	    DestroyVehicle(vehicleid);
	}
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    SetPlayerWorldBounds(playerid, 9999.9, -9999.9, 9999.9, -9999.9 );
	new string[128];
	#if CHRISTMAS_BUILD == 1
	ShowChristmasText(playerid);
	SetTimerEx("HideChristmasText", 10000, 0, "i", playerid);
	#endif

	if(pGame[playerid])
	{
	    pGame[playerid] = 0;
	}
    Spawned2[playerid] = 0;
    if(PlayerInfo[playerid][Level] == 1338)
    {
		SetPlayerHealth(killerid,1.0);
		SendClientMessage(killerid,red,"Oops!");
	}
	if(handofgod[playerid] == 1)
	{
		//SetPlayerGravity(playerid,0.008);
		handofgod[playerid] = 0;
	}
	if(PlayerInfo[playerid][InRestricted] > 0)
 	{
 		PlayerInfo[playerid][InRestricted] = 0;
	}
	if(PlayerHitman[playerid])
    {
        if(killerid == INVALID_PLAYER_ID)
        {
            GameTextForAll("~r~The chase is over!",5000,5);
            format(lolz,128,"%s has died with no killer, the minigame is over!",PlayerName3(playerid));
            SendClientMessageToAll(red,lolz);
            EndHitman();
            return false;
        }
		GameTextForAll("The chase is over!",5000,5);
        format(lolz,128,"%s has neutralized %s! The threat is gone!",PlayerName3(killerid),PlayerName3(playerid));
        SendClientMessageToAll(red,lolz);
        EndHitman();
        GivePlayerMoney(killerid,CASH_PRIZE);
    }
    if(reason == 49 && killerid != INVALID_PLAYER_ID && PlayerInfo[killerid][Level] < 2)
	{
		SendClientMessage(killerid,red,"WARNING: Carkilling is considered a lame kill and punishable! Prepare for your punishment!");
		new str[254];
		format(str,sizeof(str),"** %s must of left the handbrake off, he just carkilled %s!", killerid, playerid);
		SendClientMessageToAll(Gray,str);
		ShowMenuForPlayer(Revenge,playerid);
		KillerID[playerid] = killerid;
	}

    SendDeathMessage(killerid,playerid,reason);
	if(AdminGaveMeIt[playerid] == 1)
	{ // Anti-Anticheat savior
        AdminGaveMeIt[playerid] = 0;
	}
    new killedplayer[MAX_PLAYER_NAME]; new killah[MAX_PLAYER_NAME]; new str2[254];
    if(bounty[playerid] > 0 && (playerGang[killerid] == 0 || playerGang[playerid] != playerGang[killerid]))
	{
        GetPlayerName(playerid, killedplayer, sizeof(killedplayer));
        GetPlayerName(killerid, killah, sizeof(killah));
        format(string, sizeof(string), "*** You earned a bounty of %d for killing %s.", bounty[playerid], killedplayer);
        format(str2, sizeof(str2), "*** %s killed %s for a bounty of %d.",killah, killedplayer, bounty[playerid]);
        SendClientMessage(killerid, MANAGEMENT, string);
        SendClientMessageToAll(DAYTONA_YELLOW,str2);
        GivePlayerMoney(killerid, bounty[playerid]);
        bounty[playerid] = 0;
    }

	#if defined USE_STATS
    PlayerInfo[playerid][Deaths]++;
	#endif
    InDuel[playerid] = 0;
	if(PlayerInfo[playerid][Jailed] == 1)
    {
        if(killerid != INVALID_PLAYER_ID)
        {
        	//SetTimerEx("JailPlayer",3000,0,"d",playerid);
        	SetTimerEx("JailPlayer",1500,0,"d",killerid);
        	SendClientMessage(killerid, Red, "You have been jailed for killing prisoners!");
		}
	}
	if(PlayerInfo[playerid][IsInDuel])
	{
	    SetPosAndAngle(playerid, PlayerInfo[playerid][DuelX], PlayerInfo[playerid][DuelY], PlayerInfo[playerid][DuelZ], PlayerInfo[playerid][DuelAng]);
	    format(string, sizeof(string), "* You lost a duel against %s! You lose 1 point on your DuelKill ratio.", pName(killerid)); SendClientMessage(playerid, Red, string);
	    format(string, sizeof(string), "* You won a duel against %s! You gained 1 point on your DuelKill ratio.",pName(playerid)); SendClientMessage(killerid, MANAGEMENT, string);
	}

	SetPlayerWantedLevel(playerid,0);
	IsSuicidal[playerid] = 0;
	ResetPlayerWeapons(playerid);

	for(new j=0; j < MAX_POINTS; j++)
	{
        if(IsPlayerInArea(playerid, 2024.7416, 2005.4966, 1550.3198, 1540.4237) || IsPlayerInArea(playerid, 2004.7008, 1995.9325, 1559.4998, 1518.5879))
        {
            SetPlayerHealth(killerid,10.0);
            SendClientMessage(playerid,red,"*** Your killer has been punished!");
		    ResetPlayerWeapons(killerid);
		    SendClientMessage(killerid,red,"Error: Ship-killing is not allowed!");
	    }
	}
	IsPlayerDed[playerid] = 1;

	new msg[128];
	new reasonMsg[32];
	new playercash;
	if (killerid != INVALID_PLAYER_ID)
	{
		switch (reason)
		{
			case 0:
			{
				reasonMsg = "Unarmed";
			}
			case 1:
			{
				reasonMsg = "Brass Knuckles";
			}
			case 2:
			{
				reasonMsg = "Golf Club";
			}
			case 3:
			{
				reasonMsg = "Night Stick";
			}
			case 4:
			{
				reasonMsg = "Knife";
			}
			case 5:
			{
				reasonMsg = "Baseball Bat";
			}
			case 6:
			{
				reasonMsg = "Shovel";
			}
			case 7:
			{
				reasonMsg = "Pool Cue";
			}
			case 8:
			{
				reasonMsg = "Katana";
			}
			case 9:
			{
				reasonMsg = "Chainsaw";
			}
			case 10:
			{
				reasonMsg = "Dildo";
			}
			case 11:
			{
				reasonMsg = "Dildo";
			}
			case 12:
			{
				reasonMsg = "Vibrator";
			}
			case 13:
			{
				reasonMsg = "Vibrator";
			}
			case 14:
			{
				reasonMsg = "Flowers";
			}
			case 15:
			{
				reasonMsg = "Cane";
			}
			case 22:
			{
				reasonMsg = "Pistol";
			}
			case 23:
			{
				reasonMsg = "Silenced Pistol";
			}
			case 24:
			{
				reasonMsg = "Desert Eagle";
			}
			case 25:
			{
				reasonMsg = "Shotgun";
			}
			case 26:
			{
				reasonMsg = "Sawn-off Shotgun";
			}
			case 27:
			{
				reasonMsg = "Combat Shotgun";
			}
			case 28:
			{
				reasonMsg = "MAC-10";
			}
			case 29:
			{
				reasonMsg = "MP5";
			}
			case 30:
			{
				reasonMsg = "AK-47";
			}
			case 31:
			{
				if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
				{
					switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
					{
						case 447:
						{
							reasonMsg = "Sea Sparrow Machine Gun";
						}
						default:
						{
							reasonMsg = "M4";
						}
					}
				}
				else
				{
					reasonMsg = "M4";
				}
			}
			case 32:
			{
				reasonMsg = "TEC-9";
			}
			case 33:
			{
				reasonMsg = "Rifle";
			}
			case 34:
			{
				reasonMsg = "Sniper Rifle";
			}
			case 37:
			{
				reasonMsg = "Fire";
			}
			case 38:
			{
				if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
				{
					switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
					{
						case 425:
						{
							reasonMsg = "Hunter Machine Gun";
						}
						default:
						{
							reasonMsg = "Minigun";
						}
					}
				}
				else
				{
					reasonMsg = "Minigun";
				}
			}
			case 41:
			{
				reasonMsg = "Spraycan";
			}
			case 42:
			{
				reasonMsg = "Fire Extinguisher";
			}
			case 49:
			{
				reasonMsg = "Vehicle Collision";
			}
			case 50:
			{
				if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
				{
					switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
					{
						case 417, 425, 447, 465, 469, 487, 488, 497, 501, 548, 563:
						{
    						ShowMenuForPlayer(Revenge,playerid);
							new str[128];
		    				format(str,sizeof(str),"** %s tickled %s with Helicopter Blades!", pName(killerid), pName(playerid));
		    				SendClientMessageToAll(Gray,str);
							SendClientMessage(playerid,MANAGEMENT,"*** You got your head sliced off! Take revenge!");
							SendClientMessage(killerid,MANAGEMENT,"*** Drive-bys suck! Prepare for your punishment noob!");
  							KillerID[playerid] = killerid;
							reasonMsg = "Helicopter Blades";
						}
						default:
						{
							reasonMsg = "Vehicle Collision";
						}
					}
				}
				else
				{
					reasonMsg = "Vehicle Collision";
				}
			}
			case 51:
			{
				if (GetPlayerState(killerid) == PLAYER_STATE_DRIVER)
				{
					switch (GetVehicleModel(GetPlayerVehicleID(killerid)))
					{
						case 425:
						{
							reasonMsg = "Hunter Rockets";
						}
						case 432:
						{
							reasonMsg = "Rhino Turret";
						}
						case 520:
						{
							reasonMsg = "Hydra Rockets";
						}
						default:
						{
							reasonMsg = "Explosion";
						}
					}
				}
				else
				{
					reasonMsg = "Explosion";
				}
			}
			default:
			{
				reasonMsg = "Unknown";
			}
		}
		format(msg, sizeof(msg), "*** %s killed %s. (%s)", pName(killerid), pName(playerid), reasonMsg);
	}
	else
	{
		switch (reason)
		{
			case 53:
			{
				format(msg, sizeof(msg), "*** %s died. (Drowned)", pName(playerid));
			}
			case 54:
			{
				format(msg, sizeof(msg), "*** %s died. (Splat!)", pName(playerid));
			}
			default:
			{
				format(msg, sizeof(msg), "*** %s died.", pName(playerid));
			}
		}
	}
	SendClientMessageToAll(GetPlayerColor(playerid), msg);
	#if IRC_ENABLED == 1
	format(string, sizeof(string), "04%s", msg);
	AddEcho(string);
	#endif
	{
		playercash = GetPlayerMoney(playerid);
		if (playercash > 0)
		{
			GivePlayerMoney(killerid, playercash);
			ResetPlayerMoney(playerid);
		}
		else
		{
		}
	}
 	return 1;
}

//==============================================================================

public OnPlayerText(playerid, text[])
{
	if(strval(text[0]) == answer && MathGameOn == 1)
	{
        new str[128];
        format(str,sizeof(str),"* %s has won Numb3rz with an answer of %d",PlayerName2(playerid), answer);
        SendClientMessageToAll(MAD_WHITE,str);
        GivePlayerMoney(playerid,20000);
        MathOff();
        goto p_Continue;
    }

	if(text[0] == '!')
	{
		if(playerGang[playerid] > 0)
		{
		    new gangChat[128];
		    new senderName[MAX_PLAYER_NAME];
		    new string[128];

//		    for(new i = 1; i < strlen(text)+1; i++)
//				gangChat[i]=text[i];

			strmid(gangChat,text,1,strlen(text));

			GetPlayerName(playerid, senderName, sizeof(senderName));
			format(string, sizeof(string),"%s: %s", senderName, gangChat);

			for(new i = 0; i < gangInfo[playerGang[playerid]][1]; i++)
			{
				SendClientMessage(gangMembers[playerGang[playerid]][i], VIP, string);
			}
        }
	}

	if(text[0] == '*' && PlayerInfo[playerid][Regular] == 1)
	{// || PlayerInfo[playerid][Level] >= 2) {
        new string[128]; GetPlayerName(playerid,string,sizeof(string));
		format(string,sizeof(string),"**[Xtreme]%s: %s",string,text[1]); XtremeChat(COLOR_ORANGE,string); SaveToFile("XtremeChat",string);
		return 0;
	}

	if(text[0] == '#' && PlayerInfo[playerid][Level] == 1)
	{
	    new string[128]; GetPlayerName(playerid,string,sizeof(string));
		format(string,sizeof(string),"**[VIP]%s: %s",string,text[1]); MessageToVIPz(VIP,string); SaveToFile("VIPChat",string);
		return 0;
	}

    if(text[0] == '#' && PlayerInfo[playerid][Level] >= 2)
	{
	    new string[128]; GetPlayerName(playerid,string,sizeof(string));
		format(string,sizeof(string),"** %s: %s",string,text[1]); MessageToVIPz(VIP,string); SaveToFile("VIPChat",string);
	    return 0;
	}

	if(text[0] == '@' && PlayerInfo[playerid][Level] >= 2)
	{
	    new string[128]; GetPlayerName(playerid,string,sizeof(string));
		format(string,sizeof(string),"** %s: %s",string,text[1]); MessageToAdmins(DAYTONA_YELLOW,string); SaveToFile("AdminChat",string);
	    return 0;
	}

    if(text[0] == '@')
	{
        new string[128]; GetPlayerName(playerid,string,sizeof(string));
        format(string,sizeof(string),"**[PLAYER]%s: %s",string,text[1]); MessageToAdmins(red,string); SaveToFile("PlayerAdminChat",string);
        SendClientMessage(playerid,DAYTONA_YELLOW,"*** Your message has been sent to all available administrators!");
		return 0;
	}

	if(ServerInfo[DisableChat] == 1)
	{
		SendClientMessage(playerid,red,"Administrators are making an important announcement. Chat is muted.");
	 	return 0;
	}

 	if(PlayerInfo[playerid][Muted] == 1)
	{
 		PlayerInfo[playerid][MuteWarnings]++;
 		new string[128];
		if(PlayerInfo[playerid][MuteWarnings] < ServerInfo[MaxMuteWarnings])
		{
			format(string, sizeof(string),"You are muted, if you continue to type you will be kicked. (%d / %d)", PlayerInfo[playerid][MuteWarnings], ServerInfo[MaxMuteWarnings] );
			SendClientMessage(playerid,red,string);
		}
		else
		{
			format(string, sizeof(string),"*** %s (ID %d) was kicked for exceeding mute warnings", PlayerName2(playerid), playerid);
			SendClientMessageToAll(COLOR_ORANGE,string);
			SaveToFile("KickLog",string);
			SendKickMsg(playerid, "Repeating Spam"); Kick(playerid);
		} return 0;
	}

	if(ServerInfo[AntiSpam] == 1 && (PlayerInfo[playerid][Level] < 2 && !IsPlayerAdmin(playerid)) )
	{
		if(PlayerInfo[playerid][SpamCount] == 0) PlayerInfo[playerid][SpamTime] = TimeStamp();

	    PlayerInfo[playerid][SpamCount]++;
		if(TimeStamp() - PlayerInfo[playerid][SpamTime] > SPAM_TIMELIMIT)
		{ // Its OK your messages were far enough apart
			PlayerInfo[playerid][SpamCount] = 0;
			PlayerInfo[playerid][SpamTime] = TimeStamp();
		}
		else if(PlayerInfo[playerid][SpamCount] == SPAM_MAX_MSGS)
		{
			new string[64]; format(string,sizeof(string),"%s has been kicked (Repeating Spam)", PlayerName2(playerid));
			SendClientMessageToAll(COLOR_ORANGE,string); print(string);
			SaveToFile("KickLog",string);
			SendKickMsg(playerid, "Repeating Spam");
			Kick(playerid);
		}
		else if(PlayerInfo[playerid][SpamCount] == SPAM_MAX_MSGS-1)
		{
			SendClientMessage(playerid,red,"*** Anti-Spam warning! Next is a kick.");
			return 0;
		}
	}

	if(ServerInfo[AntiSwear] == 1 && PlayerInfo[playerid][Level] < ServerInfo[MaxAdminLevel])
	for(new s = 0; s < ForbiddenWordCount; s++)
    {
		new pos;
		while((pos = strfind(text,ForbiddenWords[s],true)) != -1) for(new i = pos, j = pos + strlen(ForbiddenWords[s]); i < j; i++) text[i] = '*';
	}

	if(PlayerInfo[playerid][Caps] == 1) UpperToLower(text);
	if(ServerInfo[NoCaps] == 1) UpperToLower(text);

	for(new i = 1; i < MAX_CHAT_LINES-1; i++) Chat[i] = Chat[i+1];
 	new ChatSTR[128]; GetPlayerName(playerid,ChatSTR,sizeof(ChatSTR)); format(ChatSTR,128,"[lchat]%s: %s",ChatSTR, text[0] );
	Chat[MAX_CHAT_LINES-1] = ChatSTR;

p_Continue:

	#if IRC_ENABLED == 1
	new ircMsg[128];
	format(ircMsg, sizeof(ircMsg), "02[%d] 07%s: %s", playerid, pName(playerid), text);
	AddEcho(ircMsg);
	#endif

	// Player text dependant on worlds.
	new pWorld = GetPlayerVirtualWorld(playerid);
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(!IsPlayerConnected(i)) continue;
	    if (GetPlayerVirtualWorld( i ) != pWorld) {
 			if (GetPlayerVirtualWorld( i ) != 0) continue;
		}
		SendPlayerMessageToPlayer( i, playerid, text );
	}

	return 0;
	}

// Failed VIP RC cmds
/*
CMD:rct(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 1) {

		new InCar = IsPlayerInAnyVehicle(playerid);
		if(InCar == 0) {
			if(PlayerInfo[playerid][PlayerDynCar] != -1) CarDeleter(PlayerInfo[playerid][PlayerDynCar]);
            new Float:X,Float:Y,Float:Z,Float:Angle,LVehicleIDt;	GetPlayerPos(playerid,X,Y,Z); GetPlayerFacingAngle(playerid,Angle);
            LVehicleIDt = CreateVehicle(464,X,Y,Z,Angle,0,0,-1);	PutPlayerInVehicle(playerid,LVehicleIDt,0); CMDMessageToAdmins(playerid,"RCT");
   	   	    SetVehicleVirtualWorld(LVehicleIDt, GetPlayerVirtualWorld(playerid)); LinkVehicleToInterior(LVehicleIDt, GetPlayerInterior(playerid));
            SendClientMessage(playerid,MANAGEMENT,"Welcome to your RC Baron!");
            return PlayerInfo[playerid][PlayerDynCar] = LVehicleIDt;
		} else return SendClientMessage(playerid,red,"Error: You already have a vehicle");
	} return 0;
}

CMD:exitrc(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 1) {
		new InRC = GetPlayerVehicleID(playerid);
		if(InRC == 464) {
            EraseVehicle(GetPlayerVehicleID(playerid)); CMDMessageToAdmins(playerid,"EXITRC");
            return SendClientMessage(playerid,MANAGEMENT,"You have left your RC to re-enter type /rct");
        } else return SendClientMessage(playerid,red,"Error: You're not in the RC!");
	} return 0;
}
*/
// Endof FAILURE
//------------------
/*
     Strictly BETA BUILD commands
*/
//------------------
#if BETA_BUILD == 1
CMD:bug(playerid, params[])
{
    new FoundID = 0, ID, string[128], model, Float:Angle, pInterior, name[128], pWorld, Float:X, Float:Y, Float:Z, vID;
	if(!sscanf(params, "s[128]", name))
	{
		// Get some player stuff
		GetPlayerFacingAngle(playerid, Angle);
		GetPlayerPos(playerid, X, Y, Z);
		pInterior = GetPlayerInterior(playerid);
		pWorld = GetPlayerVirtualWorld(playerid);
		if(IsPlayerInAnyVehicle(playerid))
		{
		    vID = GetPlayerVehicleID(playerid);
		    model = GetVehicleModel(vID);
		}

		for ( new i = 1; FoundID <= 0 ; i++)
		{
		    format(string,sizeof(string),"lsx/bugs/%i.ini",i);
		    if(!dini_Exists(string))
		    {
	 	   		ID = i;
	   	   		FoundID = 1;
		    }
		}
		format(string,sizeof(string),"lsx/bugs/%i.ini",ID);
		dini_Create(string);
		dini_Set(string, "Description:", name);
		dini_FloatSet(string, "X:", X);
		dini_FloatSet(string, "Y:", Y);
		dini_FloatSet(string, "Z:", Z);
		dini_FloatSet(string, "Angle:", Angle);
		dini_IntSet(string, "Interior:", pInterior);
		dini_IntSet(string, "World:", pWorld);
		dini_Set(string, "Reported by:", pName(playerid));
		if(PlayerInfo[playerid][LoggedIn])
		{
		    dini_Set(string, "Logged in?:", "Yes");
		}
		else
		{
		    dini_Set(string, "Logged in?:", "No");
		}
		if(IsPlayerInAnyVehicle(playerid))
		{
		    dini_IntSet(string, "Vehicle ID:", vID);
		    dini_IntSet(string, "Model ID:", model);
	        dini_Set(string, "Model Name:", GetVehicleName(vID));
		}
		format(string, sizeof(string), "*Thanks for reporting this issue number %d, it will be reviewed shortly.", ID);
		SendClientMessage(playerid, DAYTONA_YELLOW, string);
		format(string, sizeof(string), "%s[%d] has reported issue number %d", pName(playerid), playerid, ID);
		MessageToAdminsEx(playerid, White, string);
	}
	else
	{
	    SendClientMessage(playerid, Red, "USAGE: /bug [Short description]");
	}
	return 1;
}

CMD:export(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    CExport__OnCommand(playerid);
	}
	return 1;
}

CMD:pickup(playerid, params[])
{
	if(PlayerInfo[playerid][Level] >= 3)
	{
	    new Float:X, Float:Y, Float:Z;
	    GetPlayerPos(playerid, X, Y, Z);
	    CreatePickup(1239, 23, X, Y, Z, GetPlayerVirtualWorld(playerid));
	}
	return 1;
}

CMD:object(playerid, params[])
{
	if(PlayerInfo[playerid][Level] >= 3)
	{
	    new Float:X, Float:Y, Float:Z;
	    GetPlayerPos(playerid, X, Y, Z);
	    CreateDynamicObject(18092, X, Y, Z, 0.0, 0.0, 0.0, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), -1, 250);
	}
	return 1;
}

CMD:fgs(playerid, params[])
{
	if(PlayerInfo[playerid][Level] >= 3)
	{
	    GlobalStatsSave();
	    SendClientMessage(playerid, MANAGEMENT, "BETA: Global Stats Saving function ran.");
	}
	return 1;
}

CMD:s(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    new Float:X, Float:Y, Float:Z, File:save;
	    GetPlayerPos(playerid, X, Y, Z);
	    if(!fexist("lsx/surprisa.txt"))
		{
			save=fopen("lsx/surprisa.txt",io_write);
			fclose(save);
			print("File 'suprisa.txt' created succesfully!");
		}

    	new entry[128], entry2[128];
		format(entry, 128, "{%.2f, %.2f, %.2f},", X, Y, Z);
		format(entry2, 128, "\r\n%s",entry);
		save = fopen("lsx/surprisa.txt", io_append);
		fwrite(save, entry2);
		fclose(save);
		SendClientMessage(playerid, White, "Position saved.");
	}
	else
	{
	    SendClientMessage(playerid, Red, "Log in, fool.");
	}
	return 1;
}

CMD:sx(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    new Float:X, Float:Y, Float:Z, Float:Angle, File:save;
	    GetPlayerPos(playerid, X, Y, Z);
	    GetPlayerFacingAngle(playerid, Angle);
	    if(!fexist("lsx/spawnpoints.txt"))
		{
			save=fopen("lsx/spawnpoints.txt",io_write);
			fclose(save);
			print("File 'spawnpoints.txt' created succesfully!");
		}

    	new entry[128], entry2[128];
		format(entry, 128, "{%.2f, %.2f, %.2f, %.2f},", X, Y, Z, Angle);
		format(entry2, 128, "\r\n%s",entry);
		save = fopen("lsx/spawnpoints.txt", io_append);
		fwrite(save, entry2);
		fclose(save);
		SendClientMessage(playerid, White, "Position saved.");
	}
	else
	{
	    SendClientMessage(playerid, Red, "Log in, fool.");
	}
	return 1;
}

CMD:bantest(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][Level] >= 5)
	    {
	        SendBanMsg(playerid, playerid, "This is a test.");
		}
		else
		{
		    return 0;
		}
	}
	else
	{
	    SendClientMessage(playerid, Red, "Log in, fool.");
	}
	return 1;
}
	
#endif

#if CHRISTMAS_BUILD == 1
	#include "lsx_inc/Christmas/Commands.pwn"
#endif

CMD:hold(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    new type[20];
	    if(sscanf(params, "s[20]", type))
	    {
	        SendClientMessage(playerid, Red, "USAGE: /hold [Type] See /holdtypes for options.");
		}
		new Index = CalculatePlayerObjectSlot(playerid);
  		if(Index != INVALID_OBJECT_SLOT)
    	{
			if(!strcmp(type, "knife"))
			{
			    SetPlayerAttachedObject(playerid, Index, 335, 5, 0.0, 0.060 ,0.0 ,180 ,0.0, 0.0);
			    SendClientMessage(playerid, White, "You're now holding a knife.");
			}
			else if(!strcmp(type, "golfclub"))
			{
			    SetPlayerAttachedObject(playerid, Index, 333, 5, 0.0, 0.060, 0.0, 180, 0.0, 0.0);
			    SendClientMessage(playerid, White, "You're now holding a golfclub.");
			}
			else if(!strcmp(type, "parachute"))
			{
			    SetPlayerAttachedObject(playerid, Index, 371, 1, 0.0, -0.1, 0.0, 0.0, 90, 0.0);
			    SendClientMessage(playerid, White, "You're now wearing a parachute.");
			}
			else if(!strcmp(type, "christmas hat"))
			{
			    SetPlayerAttachedObject( playerid, Index, 19065, 2, 0.144806, 0.011542, -0.004829, 254.856445, 67.129417, 177.844696, 2.041975, 1.000000, 1.193680 ); // SantaHat2 - 5
			}
			else if(!strcmp(type, "m4"))
			{
				SetPlayerAttachedObject( playerid, Index, 356, 1, -0.153875, -0.112862, 0.012565, 357.993225, 23.743927, 0.000000, 1.000000, 1.000000, 1.000000 ); // m4 - M4
			}
			else if(!strcmp(type, "flare"))
			{
				SetPlayerAttachedObject( playerid, Index, 354, 1, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 ); // flare - Hydra flare
			}
			else if(!strcmp(type, "helmet"))
			{
				SetPlayerAttachedObject( playerid, Index, 19112, 2, 0.182141, -0.015718, -0.001518, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 1.000000 ); // ArmyHelmet12 - pink army helmet
			}
			else if(!strcmp(type, "tv"))
			{
				SetPlayerAttachedObject( playerid, Index, 1781, 2, 0.226248, -0.287349, -0.196323, 353.060211, 283.535949, 176.054214, 1.000000, 1.000000, 1.000000 ); // MED_TV_1 - tv
			}
			else if(!strcmp(type, "minigun"))
			{
				SetPlayerAttachedObject( playerid, Index, 362, 1, -0.356928, -0.151574, -0.081042, 0.000000, 0.000000, 0.000000, 1.000000, 1.000000, 0.654429 ); // minigun - minigun back
			}
			else if(!strcmp(type, "shades"))
			{
				SetPlayerAttachedObject( playerid, Index, 19022, 2, 0.102753, 0.035546, 0.006268, 0.000000, 94.568969, 79.223724, 1.000000, 1.000000, 1.000000 ); // GlassesType17 - black shades
			}
		}
		else
		{
		    SendClientMessage(playerid, Red, "ERROR: You have maxed your player objects slots, please remove an item before continuing.");
		}
	}
	else
	{
		LoginMsg(playerid);
	}
	return 1;
}

CMD:holdtypes(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    SendClientMessage(playerid, COLOR_WHITE, "The following is a list of objects you can attach with {17D453}/mho [type]");
	    SendClientMessage(playerid, COLOR_WHITE, "minigun, shades, tv, helmet, flare, m4, christmas hat, parachute, knife, golfclub.");
	}
	return 1;
}

CMD:idling(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][Level] >= 2)
	    {
	        new pID;
	        if(sscanf(params, "u", pID)) return SendClientMessage(playerid, Red, "USAGE: /idling [PlayerID/Name]");
			{
			    if(IsPlayerPaused(pID))
			    {
			        SendClientMessage(playerid, MAD_WHITE, "System Message: This player is idling (Escape menu)");
			        return 1;
				}
				else return SendClientMessage(playerid, MAD_WHITE, "System Message: This player is not currently idling.");
			}
		}
		else return SendClientMessage(playerid, Red, "ERROR: You need to login to use this command.");
	}
	else return 0;
}

CMD:help(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    new rules, money, gangs, games, general;

		if(isnull(params))
		{
			SendClientMessage(playerid,Red,"----- Help -------------------------");
			SendClientMessage(playerid,MAD_WHITE,"- We have so much help, it needs it's own sections!");
            SendClientMessage(playerid,MAD_WHITE,"- So they have been split up into sections for different areas.");
            SendClientMessage(playerid,MAD_WHITE,"- Use /help and one of the choices below to show help for that section.");
            SendClientMessage(playerid,MAD_WHITE,"- • -> rules || • -> money || • -> gangs || • -> games || • -> general");
            SendClientMessage(playerid,Red,"--------------------------------------");
            return 1;
		}
		else if(sscanf(params, "s[7]", rules || money || gangs || games || general)) return SendClientMessage(playerid, Red, "USAGE: /help [rules, money, gangs, games, general]");
		if(strcmp(params, "rules", true) ==0)
		{
            SendClientMessage(playerid,Red,"----- Rules ----------------------");
            SendClientMessage(playerid,MAD_WHITE,"- Cheats and hacks aren't allowed here, break this rule and you're banned .. forever.");
            SendClientMessage(playerid,MAD_WHITE,"- Do not flame or use excessive bad language in mainchat.");
            SendClientMessage(playerid,MAD_WHITE,"- Do not spam, use CAPS or advertise other servers/warez/porn, etc.");
            SendClientMessage(playerid,MAD_WHITE,"- Speak English in mainchat, other languages are can be used in /pm and gang chat.");
            SendClientMessage(playerid,MAD_WHITE,"- Do not report hackers/cheaters in mainchat. Use /report [ID].");
            SendClientMessage(playerid,MAD_WHITE,"- Do not beg for money, earn your own cash .. see /help 2 for some tips!");
            SendClientMessage(playerid,MAD_WHITE,"- Do not ask to be admin, if we are not accepting applications we only invite.");
            SendClientMessage(playerid,MAD_WHITE,"- If you have ANY problem, use @[text] and a crew member will be quick to help you.");
			SendClientMessage(playerid,Red, "-------------------------------------");
			return 1;
		}
		if(strcmp(params, "money", true) ==0)
		{
			SendClientMessage(playerid,Red, "----- Money -----------------------");
			SendClientMessage(playerid,MAD_WHITE,"- There are many ways to make yourself some ca$h money in LSX.");
			SendClientMessage(playerid,MAD_WHITE,"- Killing people automatically gives you all the money they have on them at the time of death,");
			SendClientMessage(playerid,MAD_WHITE,"- you can play minigames to earn money or play some games in mainchat (/lotto, etc.)");
			SendClientMessage(playerid,MAD_WHITE,"- The only rule we ask of you is that you DO NOT beg for money, you will be muted for this.");
			SendClientMessage(playerid,MAD_WHITE,"- There are endless opportunities to make money in LSX, from properties to gambling; all waiting to be discovered!");
			SendClientMessage(playerid,Red, "-------------------------------------");
			return 1;
		}
		if(strcmp(params, "gangs", true) ==0)
		{
            SendClientMessage(playerid,Red, "----- Gang Help -------------------");
		    SendClientMessage(playerid, MAD_WHITE,"- /gang create [name] to create your own gang.");
	        SendClientMessage(playerid, MAD_WHITE,"- /gang join if you want to join a gang you have been invited to.");
		    SendClientMessage(playerid, MAD_WHITE,"- /gang invite [ID] to invite someone into your gang.");
		    SendClientMessage(playerid, MAD_WHITE,"- /gang quit to quit the gang you're in.");
		    SendClientMessage(playerid, MAD_WHITE,"- /ganginfo [number] (no number given shows your gang's info if you have one)");
		    SendClientMessage(playerid, MAD_WHITE,"- /gangs to see all of the gangs online.");
            SendClientMessage(playerid, MAD_WHITE,"- ! (prefix text for gang-chat)");
			SendClientMessage(playerid,Red, "--------------------------------------");
	        return 1;
		}
		if(strcmp(params, "games", true) ==0)
		{
            SendClientMessage(playerid,Red, "----- Minigame Help ---------------");
            SendClientMessage(playerid, MAD_WHITE,"- These minigames are currently available:");
            SendClientMessage(playerid, MAD_WHITE,"- /derby");
            SendClientMessage(playerid, MAD_WHITE,"- To start a minigame type the command of the chosen minigame, and wait for others to join.");
            SendClientMessage(playerid,Red, "--------------------------------------");
            return 1;
		}
		if(strcmp(params, "general", true) ==0)
		{
            SendClientMessage(playerid,Red, "----- General Help -------------------");
            SendClientMessage(playerid, MAD_WHITE,"- There are no set objectives in LSX.");
            SendClientMessage(playerid, MAD_WHITE,"- Some people try to find and buy all the properties, some will try");
            SendClientMessage(playerid, MAD_WHITE,"- to be the richest, some will go for highest kills, or duelling and clan wars.");
            SendClientMessage(playerid, MAD_WHITE,"- LSX is a largely 'deathmatch' based server, but is known as Freeroam.");
            SendClientMessage(playerid, MAD_WHITE,"- The possibilities are, quite frankly; endless!");
            SendClientMessage(playerid, MAD_WHITE,"- Crew are always around to help, use @[text] if you need assistance.");
            SendClientMessage(playerid, MAD_WHITE,"- Use /commands to see the available command list for you.");
            SendClientMessage(playerid,Red, "--------------------------------------");
            return 1;
		}
		return 1;
	}
	return 1;
}
#if IRC_ENABLED == 1
CMD:ircpm(playerid, botid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][Level] >= 1)
	    {
	        new string[128], iUser[80], iMsg[128];
			if(sscanf(params, "s[80]s[128]", iUser, iMsg)) return SendClientMessage(playerid, Red, "USAGE: /ircpm [user] [message]");
			else
			{
				if(!IRC_IsUserOnChannel(gGroupID, IRC_CHANNEL, iUser))
				{
				    format(string, sizeof(string), "The name '%s' is not currently connected to the IRC channel.", iUser);
				    SendClientMessage(playerid, Red, string);
				    return 1;
				}
				else
				{
				    format(string, sizeof(string), "Your message has been sent to %s", iUser);
				    SendClientMessage(playerid, White, string);
				    format(string, sizeof(string), "PM from %s[%d]: %s", pName(playerid), playerid, iMsg);
					IRC_Notice(gGroupID, iUser, string);
					return 1;
				}
			}
		}
		return 0;
	}
	return 0;
}
#endif

//-------------------------- /locate ---------------------------------------

CMD:locate(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    new pID;
	    if(sscanf(params, "u", pID)) return SendClientMessage(playerid, Red, "USAGE: /locate [PlayerID/Name]");
	    else
	    {
	        //if(PlayerInfo[pID][Hidden])) return SendClientMessage(playerid,
	        new city[64], zone[64], string[128];

			city = GetPlayerCity(pID);
       		zone = GetPlayerZone(pID);
       		format(string, sizeof(string), "%s[%d]", pName(playerid), playerid);

       		if(IsPlayerInAnyVehicle(pID))
			{
			    format(string, sizeof(string), " %s is currently cruising with a %s", string, VehicleNames[GetVehicleModel(GetPlayerVehicleID(pID))-400]);
			}
			else
			{
			    format(string, sizeof(string), "%s is on-foot", string);
			}

			if(strlen(city) > 0)
			{
			    format(string, sizeof(string), "%s in %s", string, city);
			}
			else
			{
			    format(string, sizeof(string), "%s in an unknown location", string);
			}

			if(strlen(zone) > 0)
			{
			    format(string, sizeof(string), "%s somewhere near %s", string, zone);
			}
			else
			{
			    format(string, sizeof(string), "%s", string);
			}
			SendClientMessage(playerid, COLOR_ORANGE, string);
			return 1;
		}
	}
	else
	{
		SendClientMessage(playerid, Red, "ERROR: You need to login to use this command!");
	}
	return 1;
}

//-------------------------- /a(rea) teleports -----------------------------
CMD:basketcar(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
		    Streamer_UpdateEx(playerid, 3167.9609, -2019.1992, 229.9718);
		    SetVehiclePos(GetPlayerVehicleID(playerid), 3167.9609, -2019.1992, 229.9718);
		    SetVehicleZAngle(GetPlayerVehicleID(playerid), 358.9529);
		}
		else
		{
		    Streamer_UpdateEx(playerid, 3167.9609, -2019.1992, 229.9718);
			SetPosAndAngle(playerid, 3167.9609, -2019.1992, 229.9718, 358.9529);
		}
		SendClientMessage(playerid, AREA_MSG, "* You have been teleported to the basketcar area!");
		#if IRC_ENABLED == 1
		IRCTeleportMsg(playerid, "basketcar");
		#endif
		if(PlayerInfo[playerid][TeleMsg])
		{
			TeleportMsg(playerid, "basketcar");
		}
	}
	return 1;
}

//-------------------------- Streaming Options -----------------------------
CMD:ms(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
		if(Audio_IsClientConnected(playerid))
  		{
  		    if(isnull(params)) return SendClientMessage(playerid, White, "USAGE: /ms [0-6] (0 = off)");
  		    else
  		    {
	    		switch(strval(params))
	    		{
	    			case 0:
	    			{
	    			    if(StreamID[playerid] > 0)
	    			    {
	    					Audio_Stop(playerid, StreamID[playerid]);
	    					SendClientMessage(playerid, PEPPERMINT, "Radio Switched Off.");
	    					StreamID[playerid] = 0;
	    					return 1;
						}
						else
						{
						    SendClientMessage(playerid, PEPPERMINT, "Audio Bot: You're not currently listening to any streams!");
						}
	    			}
	    			case 1:
	    			{
	    			    if(StreamID[playerid] > 0) Audio_Stop(playerid, StreamID[playerid]);
	    			    StreamID[playerid] = 1;
	    				Audio_PlayStreamed(playerid, "http://listen.di.fm/public5/trance.asx", false, false, true);
	    				SendClientMessage(playerid, PEPPERMINT, "Audio Bot: Now playing: Digitally Imported - Trance.");
						SetPlayerChatBubble(playerid, "I am now listening to !!DIGITALLY IMPORTED!! - Listen to the hottest, freshest Trance music from around the globe!", PEPPERMINT, 25.0, 10000);
						return 1;
	    			}
	    			case 2:
	    			{
	    				if(StreamID[playerid] > 0) Audio_Stop(playerid, StreamID[playerid]);
	    			    StreamID[playerid] = 2;
	    				Audio_PlayStreamed(playerid, "http://www.di.fm/wma/club.asx", false, false, true);
	    				SendClientMessage(playerid, PEPPERMINT, "Audio Bot: Now playing: Digitally Imported - Club Sounds.");
						SetPlayerChatBubble(playerid, "I am now listening to !!DIGITALLY IMPORTED!! - The hottest club and dance tunes 24/7!", PEPPERMINT, 25.0, 10000);
						return 1;
	    			}
	    			case 3:
	    			{
	    				if(StreamID[playerid] > 0) Audio_Stop(playerid, StreamID[playerid]);
	    			    StreamID[playerid] = 3;
	    				Audio_PlayStreamed(playerid, "http://www.di.fm/wma/dubstep.asx", false, false, true);
	    				SendClientMessage(playerid, PEPPERMINT, "Audio Bot: Now playing: Digitally Imported - Dubstep.");
						SetPlayerChatBubble(playerid, "I am now listening to !!DIGITALLY IMPORTED!! - The sounds of dubstep all day long!", PEPPERMINT, 25.0, 10000);
						return 1;
	    			}
	    			case 4:
	    			{
	    				if(StreamID[playerid] > 0) Audio_Stop(playerid, StreamID[playerid]);
	    			    StreamID[playerid] = 4;
	    				Audio_PlayStreamed(playerid, "http://www.di.fm/wma/classictrance.asx", false, false, true);
	    				SendClientMessage(playerid, PEPPERMINT, "Audio Bot: Now playing: Digitally Imported - Classic Trance.");
						SetPlayerChatBubble(playerid, "I am now listening to !!DIGITALLY IMPORTED!! - The sounds of classic trance all day long!", PEPPERMINT, 25.0, 10000);
						return 1;
	    			}
	    			case 5:
	    			{
	    				if(StreamID[playerid] > 0) Audio_Stop(playerid, StreamID[playerid]);
	    			    StreamID[playerid] = 5;
	    				Audio_PlayStreamed(playerid, "http://www.di.fm/wma/drumandbass.asx", false, false, true);
	    				SendClientMessage(playerid, PEPPERMINT, "Audio Bot: Now playing: Digitally Imported - DnB.");
						SetPlayerChatBubble(playerid, "I am now listening to !!DIGITALLY IMPORTED!! - Tasty assortment to satisfy your Drum n' Bass needs.", PEPPERMINT, 25.0, 10000);
						return 1;
	    			}
	    			case 6:
	    			{
	  					if(StreamID[playerid] > 0) Audio_Stop(playerid, StreamID[playerid]);
	    			    StreamID[playerid] = 6;
	    				Audio_PlayStreamed(playerid, "http://www.di.fm/wma/house.asx", false, false, true);
	    				SendClientMessage(playerid, PEPPERMINT, "Audio Bot: Now playing: Digitally Imported - House.");
						SetPlayerChatBubble(playerid, "I am now listening to !!DIGITALLY IMPORTED!! - Silky, sexy, deep house music straight from the heart of New York City!", PEPPERMINT, 25.0, 10000);
						return 1;
	    			}
	    		}
    		}
    	}
	    else
	    {
	    	SendClientMessage(playerid, PEPPERMINT, "Audio Bot: You are not connected to the audio server.");
	    	SendClientMessage(playerid, PEPPERMINT, "You may need to install the audio client, please visit the forums.");
	    	return 1;
	    }
	}
    return 1;
}

CMD:streams(playerid, params[])
{
	#pragma unused params
	if(PlayerInfo[playerid][LoggedIn])
	{
	    SendClientMessage(playerid, red, "---------------------------------------");
	    SendClientMessage(playerid, White, "This is the current list of available streams for /ms.");
	    SendClientMessage(playerid, White, "1: Trance. 2: Club Sounds. 2: Dubstep.");
	    SendClientMessage(playerid, White, "4: Classic Trance. 5: D'n'B. 6: House.");
	    SendClientMessage(playerid, White, "Station number 0 will stop the stream.");
        SendClientMessage(playerid, red, "---------------------------------------");
	}
	return 1;
}

// ------------ [ Experimental Positioning System called gPositions ] -----------

CMD:g(playerid, params[])
{
	new string[128], FileID;
	if(PlayerInfo[playerid][LoggedIn])
	{
		if(!sscanf(params, "d", FileID))
		{
		    if(FileID > MAX_gPOSITIONS || FileID < 1) return SendClientMessage(playerid, Red, "The gPosition you entered is out of range.");
	        format(string, sizeof(string), "lsx/gPositions/%i.ini", FileID);
	        if(dini_Exists(string))
	        {
	            if(gPosInfo[FileID][gvAuth] == 1 && IsPlayerInAnyVehicle(playerid))
	            {
                    SetVehiclePos(GetPlayerVehicleID(playerid), gPosInfo[FileID][gX], gPosInfo[FileID][gY], gPosInfo[FileID][gZ]);
					SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), gPosInfo[FileID][gWorld]);
					SetPlayerVirtualWorld(playerid, gPosInfo[FileID][gWorld]);
					SetPlayerInterior(playerid, gPosInfo[FileID][gInterior]);
					LinkVehicleToInterior(GetPlayerVehicleID(playerid), gPosInfo[FileID][gInterior]);
					GameTextForPlayer(playerid, gPosInfo[FileID][gName], 4000, 4);
                	format(string, sizeof(string), "You have been teleported to %s[%d]", gPosInfo[FileID][gName], FileID);
					TeleportMsg(playerid, string);
					format(string, sizeof(string), "You have been teleported to %s", string);
					SendClientMessage(playerid, AREA_MSG, string);
				}
				if(dini_Int(string, "VehicleAccess") == 0 && IsPlayerInAnyVehicle(playerid))
				{
				    SetPosAndAngle(playerid, gPosInfo[FileID][gX], gPosInfo[FileID][gY], gPosInfo[FileID][gZ], gPosInfo[FileID][gAngle]);
					new vID = GetPlayerVehicleID(playerid);
					RemovePlayerFromVehicle(playerid);
					SetVehicleToRespawn(vID);
					SetPlayerVirtualWorld(playerid, gPosInfo[FileID][gWorld]);
					SetPlayerInterior(playerid, gPosInfo[FileID][gInterior]);
					GameTextForPlayer(playerid, gPosInfo[FileID][gName], 4000, 4);
                	format(string, sizeof(string), "You have been teleported to %s[%d]", gPosInfo[FileID][gName], FileID);
					TeleportMsg(playerid, string);
					format(string, sizeof(string), "You have been teleported to %s", string);
					SendClientMessage(playerid, AREA_MSG, string);
				}
				else
				{
				    SetPosAndAngle(playerid, gPosInfo[FileID][gX], gPosInfo[FileID][gY], gPosInfo[FileID][gZ], gPosInfo[FileID][gAngle]);
					SetPlayerVirtualWorld(playerid, gPosInfo[FileID][gWorld]);
					SetPlayerInterior(playerid, gPosInfo[FileID][gInterior]);
					GameTextForPlayer(playerid, gPosInfo[FileID][gName], 4000, 4);
                	format(string, sizeof(string), "You have been teleported to %s[%d]", gPosInfo[FileID][gName], FileID);
					TeleportMsg(playerid, string);
					format(string, sizeof(string), "You have been teleported to %s", string);
					SendClientMessage(playerid, AREA_MSG, string);
				}
			}
			else
			{
			    SendClientMessage(playerid, Red, "That gPosition does not exist, or has not been created yet! [1-200]");
			    return 1;
			}
		}
		else
		{
		    SendClientMessage(playerid, Red, "USAGE: /g [1-200]");
		    return 1;
		}
	}
	else
	{
	    LoginMsg(playerid);
	}
	return 1;
}

CMD:gfillpos(playerid, params[])
{
    new ID, string[128], name[128], vAuth, gID, Float:X, Float:Y, Float:Z, Float:Angle;
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][Level] >= 3)
		{
			if(!sscanf(params, "iis[128]",gID, vAuth, name))
        	{
        	    GetPlayerPos(playerid, X, Y, Z);
				GetPlayerFacingAngle(playerid, Angle);
				new pInterior = GetPlayerInterior(playerid);
				new pWorld = GetPlayerVirtualWorld(playerid);

				format(string,sizeof(string),"lsx/gPositions/%i.ini",gID);
			    if(!dini_Exists(string))
			    {
					if(vAuth >=0  && vAuth < 2)
					{
						dini_Create(string);
						dini_Set(string, "Name", name);
						dini_FloatSet(string, "X", X);
						dini_FloatSet(string, "Y", Y);
						dini_FloatSet(string, "Z", Z);
						dini_FloatSet(string, "Angle", Angle);
						dini_IntSet(string, "Interior", pInterior);
						dini_IntSet(string, "World", pWorld);
						dini_IntSet(string, "VehicleAuth", vAuth);
						format(string, sizeof(string), "Refilled gPosition number %d with name %s. VehicleAuth Status: %d gSlots left: %i", ID, name, vAuth, GetgSlotsLeft());
						SendClientMessage(playerid, White, string);
						LoadgPosData();
					}
					else
					{
					    SendClientMessage(playerid, Red, "vAuth - Range between 0 & 1. 0 for no access and 1 for authorized access.");
					}
				}
				else
				{
				    SendClientMessage(playerid, Red, "ERROR: Selected gPosition is already filled!");
				}
			}
			else
			{
			    SendClientMessage(playerid, Red, "USAGE: /gfill [ID 1-200] [vehicles allowed? 0/1] [name]");
			}
		}
		else
		{
		    return 0;
		}
	}
	else
	{
		LoginMsg(playerid);
	}
    return 1;
}

CMD:gcreate(playerid, params[])
{
    new ID, string[128], name[128], vAuth, Float:X, Float:Y, Float:Z, Float:Angle;
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][Level] >= 3)
	    {
        	new	FoundID = 0;

			if(!sscanf(params, "is[128]", vAuth, name))
        	{
        	    GetPlayerPos(playerid, X, Y, Z);
				GetPlayerFacingAngle(playerid, Angle);
				new pInterior = GetPlayerInterior(playerid);
				new pWorld = GetPlayerVirtualWorld(playerid);

				for ( new i = 1; FoundID <= 0 ; i++)
				{
				    format(string,sizeof(string),"lsx/gPositions/%i.ini",i);
				    if(!dini_Exists(string))
				    {
			 	   		ID = i;
			   	   		FoundID = 1;
				    }
				    if( i > MAX_gPOSITIONS )
				    {
					    return true;
					}
				}
				if(vAuth >=0  && vAuth < 2)
				{
					format(string,sizeof(string),"lsx/gPositions/%i.ini",ID);
					dini_Create(string);
					dini_Set(string, "Name", name);
					dini_FloatSet(string, "X", X);
					dini_FloatSet(string, "Y", Y);
					dini_FloatSet(string, "Z", Z);
					dini_FloatSet(string, "Angle", Angle);
					dini_IntSet(string, "Interior", pInterior);
					dini_IntSet(string, "World", pWorld);
					dini_IntSet(string, "VehicleAuth", vAuth);
/*
					gPosInfo[ID][gCPID] = CreateDynamicCP(X, Y, Z, 2, pWorld, pInterior, -1, 50);
					format(string, sizeof(string),"%s\n /g %d",dini_Get(string, "Name"), ID);
					gPosInfo[ID][g3DLabel] = CreateDynamic3DTextLabel(string, AREA_MSG, X, Y, Z+0.4, 50);
					
*/
                    format(string, sizeof(string), "Created gPosition number %d with name %s. Vehicle Auth Status: %d. gSlots left: %i", ID, name, vAuth, GetgSlotsLeft());
					SendClientMessage(playerid, White, string);
					LoadgPosData();
				}
				else
				{
				    SendClientMessage(playerid, Red, "vAuth - Range between 0 & 1. 0 for no access and 1 for authorized access.");
				}
			}
			else
			{
			    SendClientMessage(playerid, Red, "USAGE: /gcreate [vehicles allowed? 0/1] [name]");
			}
		}
		else
		{
		    return 0;
		}
	}
	else
	{
		LoginMsg(playerid);
	}
    return 1;
}

CMD:gremove(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][Level] >= 3)
	    {
	        new string[128], gPosID;
	        if(!sscanf(params, "i", gPosID))
	        {
	            if(gPosID > MAX_gPOSITIONS || gPosID < 1) return SendClientMessage(playerid, Red, "The gPosition you entered is out of range.");
			    format(string,sizeof(string),"lsx/gPositions/%i.ini",gPosInfo[gPosID][gFileID]);
				if(dini_Exists(string))
				{
				    dini_Remove(string);
				    if(IsValidDynamicCP(gPosInfo[gPosID][gCPID]))
					{
						DestroyDynamicCP(gPosInfo[gPosID][gCPID]); // Destroying exisiting CP's...
					}
					if(IsValidDynamic3DTextLabel(gPosInfo[gPosID][g3DLabel]))
					{
					    DestroyDynamic3DTextLabel(gPosInfo[gPosID][g3DLabel]);
					}
				    format(string, sizeof(string), ""COL_INDIGO"The gPosition with ID:%i was successfully removed. Don't forget to replace it.", gPosInfo[gPosID][gFileID]);
				    SendClientMessage(playerid, White, string);
 					gCount --;
				}
				else
				{
				    SendClientMessage(playerid, Red, "ERROR: That gPos ID does not exist!");
				    return 1;
				}
			}
			else
			{
			    SendClientMessage(playerid, Red, "USAGE: /gremove [1-200]");
			}
		}
		else
		{
			return 0;
		}
	}
	else
	{
	    LoginMsg(playerid);
	}
	return true;
}

forward LoadgPosData();
public LoadgPosData()
{
    new string[128];
 	for(new i = 1; i < MAX_gPOSITIONS; i++)
    {
    	format(string,sizeof(string),"lsx/gPositions/%i.ini",i);
    	if(dini_Exists(string))
    	{
			if(IsValidDynamicCP(gPosInfo[i][gCPID]))
			{
				DestroyDynamicCP(gPosInfo[i][gCPID]); // Destroying exisiting CP's...
			}
			if(IsValidDynamic3DTextLabel(gPosInfo[i][g3DLabel]))
			{
			    DestroyDynamic3DTextLabel(gPosInfo[i][g3DLabel]);
			}
			gPosInfo[i][gFileID] = i;
			gPosInfo[i][gWorld] = dini_Int(string, "World");
			gPosInfo[i][gInterior] = dini_Int(string, "Interior");
			gPosInfo[i][gX] = dini_Float(string, "X");
			gPosInfo[i][gY] = dini_Float(string, "Y");
			gPosInfo[i][gZ] = dini_Float(string, "Z");
			gPosInfo[i][gAngle] = dini_Float(string, "Angle");
			gPosInfo[i][gvAuth] = dini_Int(string, "VehicleAccess");
			format(gPosInfo[i][gName], 128, dini_Get(string, "Name"));
            //So we can re-create them without getting doubles ... Hopefully.... O_OCountDynamicMapIcons()
            gPosInfo[i][gCPID] = CreateDynamicCP(gPosInfo[i][gX], gPosInfo[i][gY], gPosInfo[i][gZ], 2, gPosInfo[i][gWorld], gPosInfo[i][gInterior], -1, 50);
            format(string, sizeof(string),"%s\n Use /g %d to teleport here!", gPosInfo[i][gName], i);
			gPosInfo[i][g3DLabel] = CreateDynamic3DTextLabel(string, AREA_MSG, gPosInfo[i][gX], gPosInfo[i][gY], gPosInfo[i][gZ]+0.4, 50);
			
			gCount++;
		}
	}
	printf("\ngPositional Array Loaded. Number of positions: %i \n\nCurrent gPos Limit: %i\n\n gPosition Slots Left: %i", gCount, MAX_gPOSITIONS, GetgSlotsLeft());
	return 1;
}
//-------------------------- [Holding Objects ] --------------------------------


CMD:mho(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
		new Obj, Bone, Float:Xoff, Float: Yoff, Float: Zoff, Float: Xrot, Float: Yrot, Float: Zrot;
		if(sscanf(params, "iiF(Xoff)F(Yoff)F(Zoff)F(Xrot)F(Xrot)F(Xrot)", Obj, Bone, Xoff, Yoff, Zoff, Xrot, Yrot, Zrot)) return SendClientMessage(playerid, Red, "USAGE: /sho [ObjectID] [Bone ID](1-16) Optional: [X] [Y] [Z] [X Rot] [Y Rot] [Z Rot]");
		if(!IsValidObjectID(Obj)) return SendClientMessage(playerid, Red, "ERROR: That object ID is invalid, please try again!");
		if(Bone < 1 || Bone > 16) return SendClientMessage(playerid, Red, "ERROR: Bone ID's are 1 - 16.");
		new Index = CalculatePlayerObjectSlot(playerid);
		if(Index != INVALID_OBJECT_SLOT)
		{
			SetPlayerAttachedObject(playerid, Index, Obj, Bone, Xoff, Yoff, Zoff, Xrot, Yrot, Zrot);
		}
		PlayerInfo[playerid][HObjID] = Obj; PlayerInfo[playerid][HObjBone] = Bone;
		PlayerInfo[playerid][HObjXoff] = Xoff; PlayerInfo[playerid][HObjYoff] = Yoff; PlayerInfo[playerid][HObjZoff] = Zoff;
		PlayerInfo[playerid][HObjXrot] = Xrot;
		PlayerInfo[playerid][HObjYrot] = Yrot;
		PlayerInfo[playerid][HObjZrot] = Zrot;
		CurrentHoldingOb[playerid] = Obj;
		SendClientMessage(playerid, COLOR_GREEN, "Object successfully placed, to remove it use /rmho!");
	}
	else
	{
	    SendClientMessage(playerid, Red, "ERROR: You need to login to use this command!");
	}
	return 1;
}

CMD:avo(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
		new Obj, Float:Xoff, Float: Yoff, Float: Zoff, Float: Xrot, Float: Yrot, Float: Zrot;
		if(sscanf(params, "iF(Xoff)F(Yoff)F(Zoff)F(Xrot)F(Xrot)F(Xrot)", Obj, Xoff, Yoff, Zoff, Xrot, Yrot, Zrot)) return SendClientMessage(playerid, Red, "USAGE: /avo [ObjectID] Optional: [X] [Y] [Z] [X Rot] [Y Rot] [Z Rot]");
		if(!IsValidObjectID(Obj)) return SendClientMessage(playerid, Red, "ERROR: That object ID is invalid, please try again!");
		if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		{
		    if(vObject[playerid] == -1)
		    {
		    	vObject[playerid] = CreateDynamicObject(Obj, Xoff, Yoff, Zoff, Xrot, Yrot, Zrot, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), 400);
				AttachObjectToVehicle(vObject[playerid], GetPlayerVehicleID(playerid), Xoff, Yoff, Zoff, Xrot, Yrot, Zrot);
				SendClientMessage(playerid, COLOR_GREEN, "Object successfully placed, to remove it use /rmvo!");
			}
			else
			{
			    SendClientMessage(playerid, Red, "You can not use this command as you already have an object attached to your vehicle.");
			}
		}
		else
		{
		    SendClientMessage(playerid, Red, "ERROR: You need to be in the driver of a vehicle to use this command!");
		}
	}
	else
	{
	    SendClientMessage(playerid, Red, "ERROR: You need to login to use this command!");
	}
	return 1;
}

CMD:smho(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(CalculatePlayerObjectSlot(playerid) == INVALID_OBJECT_SLOT)
	    {
	        new string[128];
	        dUserSetINT(PlayerName2(playerid)).("HObjID", PlayerInfo[playerid][HObjID]);
			dUserSetINT(PlayerName2(playerid)).("Bone", PlayerInfo[playerid][HObjBone]);
			dUserSetFLOAT(PlayerName2(playerid)).("HObjXoff", PlayerInfo[playerid][HObjXoff]);
			dUserSetFLOAT(PlayerName2(playerid)).("HObjYoff", PlayerInfo[playerid][HObjYoff]);
			dUserSetFLOAT(PlayerName2(playerid)).("HObjZoff", PlayerInfo[playerid][HObjZoff]);
			dUserSetFLOAT(PlayerName2(playerid)).("HObjXrot", PlayerInfo[playerid][HObjXrot]);
			dUserSetFLOAT(PlayerName2(playerid)).("HObjYrot", PlayerInfo[playerid][HObjYrot]);
			dUserSetFLOAT(PlayerName2(playerid)).("HObjZrot", PlayerInfo[playerid][HObjZrot]);
			dUserSetINT(PlayerName2(playerid)).("ObjectStatus", 1);
			PlayerInfo[playerid][ObjectStatus] = 1;
			format(string, sizeof(string), "You have saved and activated your current holding object [ID:%d]. Use /my object to configure.", CurrentHoldingOb[playerid]);
			SendClientMessage(playerid, MANAGEMENT, string);
		}
		else
		{
		    SendClientMessage(playerid, Red, "ERROR: You are not currently holding any object, use /mho to choose one!");
		}
	}
	else
	{
	    SendClientMessage(playerid, Red, "ERROR: You need to be logged in to use this command.");
	}
	return 1;
}


CMD:rmho(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    new SLOT;
	    if(sscanf(params, "i", SLOT)) return SendClientMessage(playerid, Red, "USAGE: /rmho [SlotID]");
	    {
	        if(SLOT < 0 || SLOT > 4) return SendClientMessage(playerid, Red, "ERROR: Slot range 0-4");
	        if(IsPlayerAttachedObjectSlotUsed(playerid, SLOT))
	        {
	    		RemovePlayerAttachedObject(playerid, SLOT);
			}
			else
			{
			    SendClientMessage(playerid, Red, "ERROR: You are not holding any object in that slot!");
			}
	        SendClientMessage(playerid, COLOR_GREEN, "Your holding object has been removed!");
		}
	}
	else
	{
	    SendClientMessage(playerid, Red, "ERROR: You need to login to use this command!");
	}
	return 1;
}
//------------------------------- Spin -----------------------------------------
CMD:vspin(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(IsPlayerInAnyVehicle(playerid))
		{
		    SetVehicleAngularVelocity(GetPlayerVehicleID(playerid), 0.0, 0.0, 3.0);
		}
		else
		{
		    SendClientMessage(playerid, Red, "ERROR: You need to be in a vehicle to use this.");
		}
	}
	else
	{
	    SendClientMessage(playerid, Red, "ERROR: You need to login to use this command.");
	}
	return 1;
}
//------------------------------------------------------------------------------

CMD:ar(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][AutoFix] == 0)
	    {
	        PlayerInfo[playerid][AutoFix] = 1;
	        SendClientMessage(playerid, MANAGEMENT, "Auto-repair on. Abusing auto-repair for drive-bys is disallowed!");
            dUserSetINT(PlayerName2(playerid)).("AutoFix",1);
		}
		else if(PlayerInfo[playerid][AutoFix] == 1)
		{
		    PlayerInfo[playerid][AutoFix] = 0;
		    SendClientMessage(playerid, MANAGEMENT, "Auto repair disabled!");
		    dUserSetINT(PlayerName2(playerid)).("AutoFix",0);
		}
	}
	else
	{
	    SendClientMessage(playerid, Red, "ERROR: You need to login to use this command.");
	}
	return 1;
}
//========================== [ Property Commands ] =============================
//==============================================================================
/*
	if(strcmp(cmd, "/propertyhelp", true)==0 || strcmp(cmd, "/prophelp", true)==0)
	{
	    SendClientMessage(playerid, 0x6699FFAA, "|=========================================================|");
	    SendClientMessage(playerid, 0x6699FFAA, "Property-related commands:");
	    SendClientMessage(playerid, 0x66CCFFAA, "/buyproperty or /buyprop  ==>> To buy a property");
	    SendClientMessage(playerid, 0x66CCFFAA, "/sellproperty or /sellprop  ==>> To sell one of your properties");
	    SendClientMessage(playerid, 0x66CCFFAA, "/my properties or /my props  ==>> To see a list of all properties you own");
	    if(IsPlayerAdmin(playerid))
	    {
	        SendClientMessage(playerid, 0x66CCFFAA, "/sellallproperties [Admin Only] ==>> To sell all properties for all players");
		}
	    SendClientMessage(playerid, 0x6699FFAA, "|=========================================================|");
	    return 1;
	}
*/
	//==========================================================================
CMD:buy(playerid, params[])
{
	if(PlayerInfo[playerid][Registered] && PlayerInfo[playerid][LoggedIn])
	{
	    new str[128];

		new propid = IsPlayerNearProperty(playerid);

		if(propid == -1)
		{
			SendClientMessage(playerid, Red, "* You're not close enough to a property");
			return 1;
		}
		if(PlayerProps[playerid] == MAX_PROPERTIES_PER_PLAYER)
	    {
			format(str, 128, "* You already have %d properties, you can't buy more properties at this time!", PlayerProps[playerid]);
			SendClientMessage(playerid, Red, str);
			return 1;
		}
		if(PropInfo[propid][PropIsBought] == 1)
		{
			new ownerid = GetPlayerID(PropInfo[propid][PropOwner]);
			if(ownerid == playerid)
			{
			    SendClientMessage(playerid, Red, "* You already own this property!");
			    return 1;
			}
			else
			{
			    if(PropInfo[propid][PropUnbuyableTime] > 0)
			    {
					format(str, 128, "* This property is already owned by %s. You'll have to wait %d minutes before you can buy it.", PropInfo[propid][PropOwner], PropInfo[propid][PropUnbuyableTime]);
				    SendClientMessage(playerid, red, str);
				    return 1;
				}
			}
		}
		if(GetPlayerMoney(playerid) < PropInfo[propid][PropValue])
		{
		    format(str, 128, "* You don't have enough money to buy %s .", PropInfo[propid][PropName]);
		    SendClientMessage(playerid, Red, str);
		    return 1;
		}
		if(PropInfo[propid][PropIsBought] && PropInfo[propid][PropUnbuyableTime] == 0)
		{
			new ownerid = GetPlayerID(PropInfo[propid][PropOwner]);
		    format(str, 128, "* %s bought %s. You recieved a refund of $%d", pName(ownerid), PropInfo[propid][PropName], (PropInfo[propid][PropValue]/4));
			GivePlayerMoney(ownerid, (PropInfo[propid][PropValue]/4));
			SendClientMessage(ownerid, 0xFFFF00AA, str);
			PlayerProps[ownerid]--;
		}
		new name[MAX_PLAYER_NAME];
		GetPlayerName(playerid, name, sizeof(name));
		PropInfo[propid][PropOwner] = name;
		PropInfo[propid][PropIsBought] = 1;
		PropInfo[propid][PropUnbuyableTime] = UNBUYABLETIME;
		EarningsForPlayer[playerid] += PropInfo[propid][PropEarning];
        GivePlayerMoney(playerid, (0-PropInfo[propid][PropValue]));
		format(str, 128, "* You have bought %s for $%d! You will now earn %d every 15 minutes!", PropInfo[propid][PropName], PropInfo[propid][PropValue], PropInfo[propid][PropEarning]);
        SendClientMessage(playerid, MANAGEMENT, str);
        format(str, 128, "%s has bought %s", pName(playerid), PropInfo[propid][PropName]);
        SendClientMessageToAll(Gray, str);
        PlayerProps[playerid]++;
        #if IRC_ENABLED == 1
        new istr[254];
        format(istr, sizeof(istr), "4[%d]%s has bought the property %s", playerid, pName(playerid), PropInfo[propid][PropName]);
        IRC_GroupSay(gGroupID, CREW_CHAN, istr);
        AddEcho(istr);
        #endif

	} else return SendClientMessage(playerid, Red, "* You need to be registered and logged in to buy properties!");

	return 1;
}

CMD:sell(playerid, params[])
{
	if(PlayerInfo[playerid][Registered] && PlayerInfo[playerid][LoggedIn])
	{
	    new str[128];
		new propid = IsPlayerNearProperty(playerid);
		if(propid == -1)
		{
			SendClientMessage(playerid, Red, "* You need to be near a property that you own to be able to sell it.");
			return 1;
		}
		if(PropInfo[propid][PropIsBought] == 1)
		{
			new ownerid = GetPlayerID(PropInfo[propid][PropOwner]);
			if(ownerid != playerid)
			{
			    SendClientMessage(playerid, Red, "* You don't own this property!");
			    return 1;
			}
		}
		format(PropInfo[propid][PropOwner], MAX_PLAYER_NAME, "Nobody");
		PropInfo[propid][PropIsBought] = 0;
		PropInfo[propid][PropUnbuyableTime] = 0;
		GivePlayerMoney(playerid, (PropInfo[propid][PropValue]/2));
		format(str, 128, "* You sold the property %s and received $%d", PropInfo[propid][PropName], PropInfo[propid][PropValue]/2);
        SendClientMessage(playerid, MAD_WHITE, str);
        format(str, 128, "* %s has sold the property %s.", pName(playerid), PropInfo[propid][PropName]);
        SendClientMessageToAllEx(playerid, Gray, str);
        PlayerProps[playerid]--;
        EarningsForPlayer[playerid] -= PropInfo[propid][PropEarning];
        #if IRC_ENABLED == 1
        new istr[128];
        format(istr, sizeof(istr), "4%s has sold the property %s", pName(playerid), PropInfo[propid][PropName]);
        IRC_GroupSay(gGroupID, CREW_CHAN, istr);
        AddEcho(istr);
        #endif

	} else return SendClientMessage(playerid, Red, "* You need to be registered and logged in to sell properties!");

	return 1;
}
    //================================================================================================================================

CMD:sellall(playerid, params[])
{
	if(PlayerInfo[playerid][Registered] && PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][Level] >= 4)
	    {
	        for(new propid; propid<PropertiesAmount; propid++)
	        {
	            format(PropInfo[propid][PropOwner], MAX_PLAYER_NAME, "Nobody");
	            PropInfo[propid][PropIsBought] = 0;
	            PropInfo[propid][PropUnbuyableTime] = 0;
			}
			for(new i; i<MAX_PLAYERS; i++)
			{
			    if(IsPlayerConnected(i))
			    {
			        PlayerProps[i] = 0;
				}
			}
			new str[128];
			format(str, 128, "* Administrator %s has reset all properties!", pName(playerid));
			SendClientMessageToAll(MANAGEMENT, str);

		} else return 0;

	} else return SendClientMessage(playerid, Red, "* You need to be registered and logged in to sell properties!");

	return 1;
}

CMD:propid(playerid, params[])
{
	if(PlayerInfo[playerid][Level] >= 3)
	{
	    new ID, string[128];
	    ID = IsPlayerNearProperty(playerid);
	    if(ID != -1)
	    {
	        format(string, sizeof(string), "The property ID for %s is %d.", PropInfo[ID][PropName], ID);
	        SendClientMessage(playerid, MANAGEMENT, string);
		}
		else
		{
		    SendClientMessage(playerid, Red, "ERROR: You're not close enough to any properties.");
		}
	}
	else
	{
	    return 0;
	}
	return 1;
}

CMD:gotoprop(playerid, params[])
{
	if(PlayerInfo[playerid][Level] >= 3)
	{
	    new PropID, string[128];
	    if(sscanf(params, "d", PropID)) return SendClientMessage(playerid, Red, "USAGE: /gotoprop [PropID]");
		if(PropID < 1)
		{
		    SendClientMessage(playerid, Red, "This property does not exist!");
		    return 1;
		}
		if(PropInfo[PropID][PropExists])
		{
		    SetPlayerPos(playerid, PropInfo[PropID][PropX], PropInfo[PropID][PropY], PropInfo[PropID][PropZ]);
		    SetPlayerInterior(playerid, PropInfo[PropID][PropInt]);
			format(string, sizeof(string), "* You have been teleported to %s [%d]", PropInfo[PropID][PropName], PropID);
			SendClientMessage(playerid, MAD_WHITE, string);
		}
		else
		{
		    SendClientMessage(playerid, Red, "This property does not exist!");
		}
	} else return 0;
	return 1;
}

/*
CMD:gotoprop(playerid, params[])
{
	if(PlayerInfo[playerid][Level] >= 3)
	{
	    new PropID[64], string[128];
	    if(sscanf(params, "s[64]", PropID)) return SendClientMessage(playerid, Red, "USAGE: /gotoprop [PropID]");
		if(IsNumeric(PropID))
		{
			if(strval(PropID) < 1)
			{
		    	SendClientMessage(playerid, Red, "This property does not exist!");
		    	return 1;
			}
			if(PropInfo[strval(PropID)][PropExists])
			{
		    	SetPlayerPos(playerid, PropInfo[strval(PropID)][PropX], PropInfo[strval(PropID)][PropY], PropInfo[strval(PropID)][PropZ]);
		    	SetPlayerInterior(playerid, PropInfo[strval(PropID)][PropInt]);
				format(string, sizeof(string), "* You have been teleported to %s [%d]", PropInfo[strval(PropID)][PropName], strval(PropID));
				SendClientMessage(playerid, MAD_WHITE, string);
			}
			else
			{
		    	SendClientMessage(playerid, Red, "This property does not exist!");
			}
		}
		else
		{
		    if(fexist("lsx/PropertySystem/PropertyInfo.txt"))
			{
				new Argument[9][70];
				new entry[128];
				new File:Properties = fopen("lsx/PropertySystem/PropertyInfo.txt", io_read);
		    	if (Properties)
				{
		    		for(new id; id<PropertiesAmount; id++)
					{
						fread(Properties, entry);
						split(entry, Argument, ',');
						if(strfind(Argument[0], PropID, true) != -1)
						{
						    SetPlayerPos(playerid,floatstr(Argument[1]),floatstr(Argument[2]),floatstr(Argument[3]));
						    SetPlayerInterior(playerid, strval(Argument[4]));
		                }
		                format(string, sizeof(string), "You have been teleported to %s",PropID);
		                SendClientMessage(playerid, MANAGEMENT, string);
						fclose(Properties);
					}
				}
			}
			else
			{
			    SendClientMessage(playerid, Red, "Fail.");
			}
		}
	} else return 0;
	return 1;
}
*/

CMD:createprop(playerid, params[])
{
	if(PlayerInfo[playerid][Level] >= 4)
	{
	    new Propnick[64], Float:X, Float:Y, Float:Z, Value, Earning, string[128];
	    GetPlayerPos(playerid, X, Y, Z);
	    if(sscanf(params, "dds[64]", Value, Earning, Propnick)) return SendClientMessage(playerid, Red, "USAGE: /createprop [Cost] [Earning] [Name]");
	    CreateProperty(Propnick, X, Y, Z, GetPlayerInterior( playerid ), Value, Earning);
	    format(string, sizeof(string), "* Successfully created the property %s", Propnick);
	    SendClientMessage(playerid, MAD_WHITE, string);
	    return 1;
	} else return 0;
}
/*
CMD:propid(playerid, params[])
{
	if(PlayerInfo[playerid][Level] >= 3)
	{
	    new pSearch[64], string;
	    if(sscanf(params, "s[64]", pSearch)) return SendClientMessage(playerid, Red, "USAGE: /propid [name]");
	    format(string, sizeof(string), "* The ID of the property you searched for is %d", GetPropertyID(pSearch));
	    SendClientMessage(playerid, MANAGEMENT,string);
		return 1;
	}
}
*/
//===============================================

CMD:timeon(playerid,params[])
{
	if(PlayerInfo[playerid][Level] < 3) return 0;
    new checkplayerid;
    if(sscanf(params,"u",checkplayerid)) return SendClientMessage(playerid,MAD_WHITE,"Usage: /timeon [ID/part of player name]");
    else if(checkplayerid == INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"Player not found");
    else
    {
        new string[64],name[MAX_PLAYER_NAME];
        GetPlayerName(checkplayerid,name,sizeof(name));
        format(string,sizeof(string),"%s has been online for %i minutes",name,PlayerTime[checkplayerid]);
        SendClientMessage(playerid,White,string);
    }
    return 1;
}

CMD:slap(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(JustSlapped[playerid] == 0)
	    {
	    	new string[128], slapped;
	    	new money = GetPlayerMoney(playerid);
	    	if(sscanf(params, "u", slapped)) return SendClientMessage(playerid, Red, "USAGE: /slap [PlayerID]");
			if(money < 5) return SendClientMessage(playerid, Red, "You need $5 to slap somebody!");
			if(IsPlayerConnected(slapped) && slapped != INVALID_PLAYER_ID && slapped != playerid)
	    	{
	    		format(string, sizeof(string), "%s slapped %s with a %s!", pName(playerid), pName(slapped),RandomSlaps[random(sizeof(RandomSlaps))]);
	    		SendClientMessageToAll(Gray, string);
	    		GameTextForPlayer(slapped,"SLAPPED",3000, 2);
				TakePlayerMoney(playerid, 5);
	    		JustSlapped[playerid] = 1;
	    		SetTimerEx("AllowSlap",10000, false, "i", playerid);
			} else return SendClientMessage(playerid, Red, "Invalid ID");
		} else return SendClientMessage(playerid, Red, "You can only slap someone every 10 seconds!");
	} else return SendClientMessage(playerid, Red, "Please log-in before using commands!");
	return 1;
}
/*
CMD:a(playerid,params[])
{
	new iThink;
    if(MathGameOn == 0) return SendClientMessage(playerid, red, "There is no Numb3rz sum to answer!");
    if(sscanf(params, "u", iThink)) return SendClientMessage(playerid,red,"USAGE: /(a)nswer [number(s)]");
	//7 if(IsNumeric(tmp)) return SendClientMessage(playerid,red,"USAGE: /(a)nswer [number(s)]");

    if(iThink == answer) {
        new str[254];
        format(str,sizeof(str),"* %s has won Numb3rz with an answer of %d",PlayerName2(playerid), answer);
        SendClientMessageToAll(MAD_WHITE,str);
        GivePlayerMoney(playerid,20000);
        MathOff();
    } else return SendClientMessage(playerid,red,"Wrong answer!");
    return 1;
}

CMD:heal(playerid, params[]) {
	#pragma unused params
	new cash = GetPlayerMoney(playerid);
	new str[128];
	new Float:health; GetPlayerHealth(playerid, health);
	if(cash < 1000000 && PlayerInfo[playerid][Level] < 2) {
		SendClientMessage(playerid, red, "You need $1,000,000 for this command!");
		return 1;
	}
	if(health > 99.0) return SendClientMessage(playerid,red,"Your health is already full!");
	if(PlayerInfo[playerid][Level] < 2) {
        GivePlayerMoney(playerid, -1000000);
	}
	SetPlayerHealth(playerid, 100.0);
	SendClientMessage(playerid,MANAGEMENT,"** You have successfully healed.");
	format(str,sizeof(str),"[ALERT]%s has healed", PlayerName2(playerid));
	MessageToAdmins(red,str);
	return 1;
}
*/
CMD:info(playerid,params[]) {
	#pragma unused params
	SendClientMessage(playerid,JEROME,"-----------------------------------------");
	SendClientMessage(playerid,JEROME,"This script is currently not available for public use. Created by Jerome");
	SendClientMessage(playerid,JEROME,"-----------------------------------------");
	return 1;
}

CMD:drunk(playerid,params[]) {
	//#pragma unused params
	if(PlayerInfo[playerid][Level] >= 3) {
		new str[128];
		new drunk = strval(params);
		if(!strlen(params)) return SendClientMessage(playerid,red,"USAGE: /drunk 1-50000");
		if(drunk > 50000) return SendClientMessage(playerid,red,"Max is 50000!");
		if(drunk > 2000)
		SetPlayerDrunkLevel(playerid,drunk);
		drunken[playerid] = 1;
		format(str,sizeof(str),"You have now consumed %d mg's of alcohol!", drunk);
		SendClientMessage(playerid,MANAGEMENT,str);
	} else return 0;
	return 1;
}

CMD:soberup(playerid, params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 3) {
	    if(drunken[playerid] == 0) return SendClientMessage(playerid,red,"You're already sober! Use /drunk to get smashed!");
	    drunken[playerid] = 0;
	    SetPlayerDrunkLevel(playerid,0);
		return ClearAnimations(playerid);
	} else return 0;
}

CMD:donate(playerid,params[])
{
	#pragma unused params
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
        SendClientMessage(playerid,MAD_WHITE,"======================================");
		SendClientMessage(playerid,red,"========== Donating to Los Santos Xtreme =========");
		SendClientMessage(playerid,MAD_WHITE,"======================================");
		SendClientMessage(playerid,MAD_WHITE,"Donating to LSX opens up more features for you, more commands and");
		SendClientMessage(playerid,MAD_WHITE,"a private chat channel in-game and on IRC. Most importantly it helps us to keep");
		SendClientMessage(playerid,MAD_WHITE,"LSX running. Full information about becoming a VIP can be found on our forums at");
		SendClientMessage(playerid,JEROME,"           http://playlsx.co.cc");
        SendClientMessage(playerid,MAD_WHITE,"======================================");
	} else return SendClientMessage(playerid, Red, "ERROR: You need to be registered and logged in to use this command.");
	return 1;
}

CMD:vallow(playerid,params[])
{
	if(PlayerInfo[playerid][Level] >= 3)
	{
		new player1, str[128];
		if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /vallow [playerid]");
		if(PlayerInfo[player1][Level] >= 2) return SendClientMessage(playerid, red, "Error: Selected player is an Administrator/Moderator!");
		if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
		{
			Vallow[player1] = 1;
			SendClientMessage(player1, MANAGEMENT, "*** An Administrator has given you temporary access to Admin vehicles!");
			format(str,sizeof(str)," *** You have given %s vallow", PlayerName2(player1));
			SendClientMessage(playerid,MANAGEMENT,str);
			return 1;
		}
		else return SendClientMessage(playerid,red,"Error: Player not connected, etc.");
    }
	else return 0;
}

CMD:takevallow(playerid,params[])
{
	if(PlayerInfo[playerid][Level] >= 3)
	{
		new player1, str[128];
		if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /takevallow [playerid]");
		if(PlayerInfo[player1][Level] >= 2) return SendClientMessage(playerid, red, "Error: Selected player is an Administrator/Moderator!");
		if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
		{
			Vallow[player1] = 0;
			SendClientMessage(player1, MANAGEMENT, "*** An Administrator has revoked your temporary access to Admin vehicles!");
			format(str,sizeof(str)," *** You have taken %s's vallow", PlayerName2(player1));
			SendClientMessage(playerid,MANAGEMENT,str);
			return 1;
		}
		else return SendClientMessage(playerid,red,"Error: Player not connected, etc.");
    }
	else return 0;
}

CMD:gotogarage(playerid, params[])
{
	#pragma unused params

	if(PlayerInfo[playerid][Level] >= 3)
	{
        SetPlayerInterior(playerid,18);
		if(IsPlayerInAnyVehicle(playerid))
		{
			new car = GetPlayerVehicleID(playerid);
			LinkVehicleToInterior(car,18);
			SetVehiclePos(car,1305.1489,-45.5465,1000.6863);
			SetPlayerCheckpoint(playerid,1292.5637,4.7473,1001.0104,5.0);
			SetVehicleZAngle(car,90);
			SetCameraBehindPlayer(playerid);
			SendClientMessage(playerid,MANAGEMENT,"** Welcome to the top secret crew warehouse");
			return 1;
		}
		SetPlayerCheckpoint(playerid,1292.5637,4.7473,1001.0104,5.0);
		SetPlayerPos(playerid,1306.8914,-55.3479,1002.4979);
		SetPlayerFacingAngle(playerid,90);
		SetCameraBehindPlayer(playerid);
		SendClientMessage(playerid,MANAGEMENT,"** Welcome to the top secret crew warehouse");
		return 1;
	}
	else return 0;
}

CMD:givearms(playerid, params[])
{
	if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
	{
		new weaponid, ammo, string[128], gun[30], playa;
		if(sscanf(params, "uii", playa, weaponid, ammo)) return SendClientMessage(playerid, White, "USAGE: /givearms [playerID] [weaponID] [Ammo]");
		if(weaponid > 46 || weaponid < 1) return SendClientMessage(playerid,Red,"Invalid Weapon ID!");
		if(IsPlayerConnected(playa) && PlayerInfo[playa][LoggedIn])
		{
			GetWeaponName(weaponid,gun,30);
		    if(playa != playerid)
		    {
				format(string,sizeof(string),"You gave %s a %s with %d rounds of ammunition!", pName(playa),gun, ammo); SendClientMessage(playerid,White,string);
				format(string,sizeof(string),"You have recieved a %s with %d round of ammunition from Administrator %s",gun, ammo, pName(playerid)); SendClientMessage(playa, Green, string);
				format(string,sizeof(string),"%s gave %s a %s with %d rounds of ammunition",pName(playerid),pName(playa),gun, ammo); MessageToAdmins(White, string);
				return GivePlayerWeapon(playa, weaponid, ammo);
			} else {
			    format(string,sizeof(string),"You gave yourself a %s with %d rounds of ammunition!", gun, ammo); SendClientMessage(playerid,White,string);
				format(string,sizeof(string),"%s gave himself a %s with %d rounds of ammunition",pName(playerid),gun, ammo); MessageToAdmins(White, string);
				return GivePlayerWeapon(playa, weaponid, ammo);
			}
		} else return SendClientMessage(playerid, Red,"Player is not connected or is not logged in!");
	} else return 0;
}

CMD:givespawn(playerid, params[])
{
	if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
	{
		new weaponid, ammo, string[128], gun[30], playa;
		if(sscanf(params, "uii", playa, weaponid, ammo)) return SendClientMessage(playerid, White, "USAGE: /givearms [playerID] [weaponID] [Ammo]");
		if(weaponid > 46 || weaponid < 1) return SendClientMessage(playerid,Red,"Invalid Weapon ID!");
		if(IsPlayerConnected(playa) && PlayerInfo[playa][LoggedIn])
		{
			GetWeaponName(weaponid,gun,30);
		    if(playa != playerid)
		    {
				format(string,sizeof(string),"You gave %s a %s with %d rounds of ammunition!", pName(playa),gun, ammo); SendClientMessage(playerid,White,string);
				format(string,sizeof(string),"You have recieved a %s with %d round of ammunition from Administrator %s",gun, ammo, pName(playerid)); SendClientMessage(playa, Green, string);
				format(string,sizeof(string),"%s gave %s a %s with %d rounds of ammunition",pName(playerid),pName(playa),gun, ammo); MessageToAdmins(White, string);
				return GivePlayerSpawnWeapon(playa, weaponid, ammo);
			} else {
			    format(string,sizeof(string),"You gave yourself a %s with %d rounds of ammunition!", gun, ammo); SendClientMessage(playerid,White,string);
				format(string,sizeof(string),"%s gave himself a %s with %d rounds of ammunition",pName(playerid),gun, ammo); MessageToAdmins(White, string);
				return GivePlayerSpawnWeapon(playa, weaponid, ammo);
			}
		} else return SendClientMessage(playerid, Red,"Player is not connected or is not logged in!");
	} else return 0;
}

CMD:sethealth(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
		new player1, health, string[128];
		if(sscanf(params, "ui", player1, health)) return SendClientMessage(playerid, White, "USAGE: /sethealth [PlayerID] [Health]");
		if(health > 100 || health < 0) return SendClientMessage(playerid, red, "Invalid Amount");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
		if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
		{
			format(string, sizeof(string), "You have set %s's health to %d.0", pName(player1), health); SendClientMessage(playerid,MANAGEMENT,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has set your health to %d", pName(playerid), health); SendClientMessage(player1,MANAGEMENT,string); }
   			return SetPlayerHealth(player1, health);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:setarmour(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
        new player1, armour, string[128];
	    if(sscanf(params, "ui", player1, armour)) return SendClientMessage(playerid, red, "USAGE: /setarmour [playerid] [amount]");
		if(armour > 100 || armour < 0) return SendClientMessage(playerid, red, "Invalid Amount");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
		{
			format(string, sizeof(string), "You have set %s's armour to %d.0", pName(player1), armour); SendClientMessage(playerid,MANAGEMENT,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has set your armour to %d", pName(playerid), armour); SendClientMessage(player1,MANAGEMENT,string); }
   			return SetPlayerArmour(player1, armour);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:setcash(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
	    new player1, cash, string[128];
	    if(sscanf(params, "ui", player1, cash)) return SendClientMessage(playerid, red, "USAGE: /setcash [playerid] [amount]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			format(string, sizeof(string), "You have set %s's cash to $%d", pName(player1), cash); SendClientMessage(playerid,MANAGEMENT,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has set your cash to $%d", pName(playerid), cash); SendClientMessage(player1,MANAGEMENT,string); }
			ResetPlayerMoney(player1);
   			return GivePlayerMoney(player1, cash);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:setscore(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
	    new player1, score, string[128];
	    if(sscanf(params, "ui", player1, score)) return SendClientMessage(playerid, red, "USAGE: /setscore [playerid] [score]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			format(string, sizeof(string), "You have set %s's score to %d", pName(player1), score); SendClientMessage(playerid,MANAGEMENT,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has set your score to %d", pName(playerid), score); SendClientMessage(player1,MANAGEMENT,string); }
   			return SetPlayerScore(player1, score);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:setskin(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
	    new player1, skin, string[128];
	    if(sscanf(params, "ui", player1, skin)) return SendClientMessage(playerid, red, "USAGE: /setskin [playerid] [skin id]");
		if(!IsValidSkin(skin)) return SendClientMessage(playerid, red, "ERROR: Invaild Skin ID");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {

			format(string, sizeof(string), "You have set %s's skin to %d", pName(player1), skin); SendClientMessage(playerid,MANAGEMENT,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has set your skin to '%d'", pName(playerid), skin); SendClientMessage(player1,MANAGEMENT,string); }
   			return SetPlayerSkin(player1, skin);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:setwanted(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
	    new player1, wanted, string[128];
	    if(sscanf(params, "ui", player1, wanted)) return SendClientMessage(playerid, red, "USAGE: /setwanted [playerid] [level]");
		if(wanted > 6) return SendClientMessage(playerid, red, "ERROR: Invalid wanted level");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			CMDMessageToAdmins(playerid,"SETWANTED");
			format(string, sizeof(string), "You have set %s's wanted level to %d", pName(player1), wanted); SendClientMessage(playerid,MANAGEMENT,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has set your wanted level to %d", pName(playerid), wanted); SendClientMessage(player1,MANAGEMENT,string); }
   			return SetPlayerWantedLevel(player1, wanted);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:setcolour(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
	    new player1, Colour, string[128], colour[24];
	    if(sscanf(params, "ui", player1, Colour)) return SendClientMessage(playerid, red, "USAGE: /setcolour [playerid] [Colour] Hint: See /colours for a list of colours.");
		if(Colour > 31) return SendClientMessage(playerid, red, "See /colours for a list of colours.");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			switch (Colour)
			{
			    case 0: { SetPlayerColor(player1,black); colour = "Black"; }
			    case 1: { SetPlayerColor(player1,COLOR_WHITE); colour = "White"; }
			    case 2: { SetPlayerColor(player1,red); colour = "Red"; }
			    case 3: { SetPlayerColor(player1,orange); colour = "Orange"; }
				case 4: { SetPlayerColor(player1,orange); colour = "Yellow"; }
				case 5: { SetPlayerColor(player1,COLOR_GREEN1); colour = "Green"; }
				case 6: { SetPlayerColor(player1,COLOR_BLUE); colour = "Blue"; }
				case 7: { SetPlayerColor(player1,COLOR_PURPLE); colour = "Purple"; }
				case 8: { SetPlayerColor(player1,COLOR_BROWN); colour = "Brown"; }
				case 9: { SetPlayerColor(player1,COLOR_PINK); colour = "Pink"; }
				case 10:{ SetPlayerColor(player1,GRAPE); colour = "Grape"; }
				case 11:{ SetPlayerColor(player1,STRAWBERRY); colour = "Strawberry"; }
				case 12:{ SetPlayerColor(player1,NAIS); colour = "Nais"; }
				case 13:{ SetPlayerColor(player1,FIREBURNT); colour = "Fireburnt"; }
				case 14:{ SetPlayerColor(player1,JEROME); colour = "Jerome"; }
				case 15:{ SetPlayerColor(player1,GOLD); colour = "Gold"; }
				case 16:{ SetPlayerColor(player1,PEPPERMINT); colour = "Peppermint"; }
				case 17:{ SetPlayerColor(player1,FRESHWATER); colour = "Freshwater"; }
				case 18:{ SetPlayerColor(player1,LIME); colour = "Lime"; }
				case 19:{ SetPlayerColor(player1,MILK_CHOCOLATE); colour = "Milk Chocolate"; }
				case 20:{ SetPlayerColor(player1,DAYDREAM); colour = "Daydream"; }
				case 21:{ SetPlayerColor(player1,DAYTONA_YELLOW); colour = "Daytona Yellow"; }
				case 22:{ SetPlayerColor(player1,DEEP_CHERRY); colour = "Deep Cherry"; }
				case 23:{ SetPlayerColor(player1,CANDY_APPLE); colour = "Apple"; }
				case 24:{ SetPlayerColor(player1,INVISIBLE); colour = "Invisible"; }
				case 25:{ SetPlayerColor(player1,FOREST_CANOPY); colour = "Forest"; }
				case 26:{ SetPlayerColor(player1,CLUB_SODA); colour = "Soda"; }
				case 27:{ SetPlayerColor(player1,MAD_WHITE); colour = "Ghost"; }
				case 28:{ SetPlayerColor(player1,BLACKCURRANT); colour = "Blackcurrant"; }
				case 29:{ SetPlayerColor(player1,CLEAN_GREEN); colour = "Clean Green"; }
				case 30:{ SetPlayerColor(player1,GRAY); colour = "Gray"; }
				case 31:{ SetPlayerColor(player1,BARBIE); colour = "Barbie Pink"; }
			}
			if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has set your colour to %s ", pName(playerid), colour); SendClientMessage(player1,MANAGEMENT,string); }
			format(string, sizeof(string), "You have set %s's colour to %s ", pName(player1), colour);
   			return SendClientMessage(playerid,MANAGEMENT,string);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:colours(playerid,params[]) {
	#pragma unused params
    if(PlayerInfo[playerid][Level] >= 3) {
		SendClientMessage(playerid, MANAGEMENT, "Admin Colourlist:");
	    SendClientMessage(playerid, MANAGEMENT, "-------------------------------------------------------------------------");
	    SendClientMessage(playerid, COLOR_ORANGE, "0 - Black   |  8 - Brown      | 16 - Peppermint     | 24 - Invisible");
	    SendClientMessage(playerid, COLOR_ORANGE, "1 - White   |  9 - Pink       | 17 - Freshwater     | 25 - Forest Green");
	    SendClientMessage(playerid, COLOR_ORANGE, "2 - Red     | 10 - Grape      | 18 - Lime           | 26 - Club Soda ");
		SendClientMessage(playerid, COLOR_ORANGE, "3 - Orange  | 11 - Strawberry | 19 - Milk Chocolate | 27 - Ghost");
		SendClientMessage(playerid, COLOR_ORANGE, "4 - Yellow  | 12 - Nais       | 20 - Daydream       | 28 - Blackcurrant");
		SendClientMessage(playerid, COLOR_ORANGE, "5 - Green   | 13 - Fireburnt  | 21 - Daytona Yellow | 29 - Clean Green");
		SendClientMessage(playerid, COLOR_ORANGE, "6 - Blue    | 14 - Jerome     | 22 - Deep Cherry    | 30 - Gray");
		SendClientMessage(playerid, COLOR_ORANGE, "7 - Purple  | 15 - Gold       | 23 - Candy Apple    | 31 - Barbie Pink");
        SendClientMessage(playerid, MANAGEMENT, "-------------------------------------------------------------------------");
	 } else return 0;
    return 1;
}

CMD:setweather(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
	    new player1, weather, string[128];
	    if(sscanf(params, "ui", player1, weather)) return SendClientMessage(playerid, red, "USAGE: /setweather [playerid] [weather id]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			format(string, sizeof(string), "You have set %s's weather to ID %d", pName(player1), weather); SendClientMessage(playerid,MANAGEMENT,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has set your weather to ID %d", pName(playerid), weather); SendClientMessage(player1,MANAGEMENT,string); }
			SetPlayerWeather(player1,weather);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:setworld(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
	    new player1, time, string[128];
	    if(sscanf(params, "ui", player1, time)) return SendClientMessage(playerid, red, "USAGE: /setworld [playerid] [virtual world]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			format(string, sizeof(string), "You have set %s's virtual world to %d", pName(player1), time); SendClientMessage(playerid,MANAGEMENT,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has set your virtual world to %d ", pName(playerid), time); SendClientMessage(player1,MANAGEMENT,string); }
			IsPlayerInAnyVehicle(playerid), SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), time);
   			return SetPlayerVirtualWorld(player1, time);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

// ------------ Player accessible /world command ;) (by Jerome) -------------------------------//

CMD:world(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
        new world, string[128];
	    if(sscanf(params, "i", world)) return SendClientMessage(playerid, red, "USAGE: /world [1-254]");
        new ffs = IsPlayerInAnyVehicle(playerid);
        if(ffs && GetPlayerState(playerid) == PLAYER_STATE_PASSENGER) return SendClientMessage(playerid,red,"Error: Only the driver can do this!");

        if(world < MAX_WORLD) { // Max worlds accessable .. to players directly through this command, is 254.
            new Wtf = GetPlayerVirtualWorld(playerid);
            if(Wtf != world) {

                format(string, sizeof(string),"[ALERT]%s has gone to virtual world %d!", PlayerName2(playerid), world);
                MessageToAdmins(red, string);
                IsPlayerInAnyVehicle(playerid);
			    SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), world);
                SetPlayerVirtualWorld(playerid,world);
                if(world > 0) {

                    format(string, sizeof(string),"*** You have gone to virtual world %d!", world);
                    SendClientMessage(playerid,MANAGEMENT,string);
                    return SetPlayerVirtualWorld(playerid, world);
                } else {
					format(string, sizeof(string),"*** Welcome back to the main world %s!", PlayerName2(playerid));
					SendClientMessage(playerid,MANAGEMENT,string);
				}
            } else return SendClientMessage(playerid,red,"Error: You're already in that world!");
        } else return SendClientMessage(playerid,red,"Error: You can only select a world between 1 and 254!");
    } else return SendClientMessage(playerid,red,"Error: You need to be logged in to use this command");
	return 1;
}

//------------------------------------ Anti-cheat control -------------------------------------------//

CMD:antihack(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
		new on, off;
		if(sscanf(params, "s", on || off)) return SendClientMessage(playerid, red, "USAGE: /antihack on/off");
        new string[128];
	    if(strcmp(params,"off",true) == 0) {
            if(AcActive == 1) {
			    KillTimer(hackchecktimer);
			    format(string, sizeof(string), "[ALERT] %s turned off iBan", PlayerName2(playerid));
		        MessageToAdmins(red,string);
			    SendClientMessage(playerid,MANAGEMENT,"*** Anticheat is now off!");
			    AcActive =0;
			    return 1;
			} else return SendClientMessage(playerid,red,"Error: The anticheat is already disabled!");
	    }
		else if(strcmp(params,"on",true) == 0) {
            if(AcActive == 0) {
			    SetTimer("GlobalHackCheck", 1000, 1);
			    format(string, sizeof(string), "[ALERT] %s turned iBan back on", PlayerName2(playerid));
			    MessageToAdmins(red,string);
			    SendClientMessage(playerid,MANAGEMENT,"*** Anticheat is now running again!");
			    AcActive =1;
			    return 1;
            } else return SendClientMessage(playerid,red,"Error: The anticheat is already enabled!");
		} else return SendClientMessage(playerid,red,"Error: /antihack on/off");
	} else return 0;
}

CMD:spawncolour(playerid,params[])
{
    if(PlayerInfo[playerid][LoggedIn] == 1)
	{
		if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
		{
		    new pID, colour;
			if(sscanf(params, "ux", pID, colour)) return SendClientMessage(playerid, Red, "USAGE: /spawncolour [playerid] [code]");

			if(IsPlayerConnected(pID))
			{
				if(PlayerInfo[pID][LoggedIn] && PlayerInfo[pID][Registered] && IsPlayerVIP(pID))
				{
					dUserSetINT(PlayerName2(pID)).("SpawnColour", colour);
					PlayerInfo[pID][SpawnColour] = dUserINT(PlayerName2(pID)).("SpawnColour");
					SetPlayerColor(playerid, PlayerInfo[pID][SpawnColour]);
					SendClientMessage(playerid,MANAGEMENT, "*** Spawncolour for this player successfully set");
					return 1;
				}
				else return SendClientMessage(playerid,red,"ERROR: Player must be registered, logged in and be a V.I.P.");
			}
			else
			{
   				if(udb_Exists(pName(pID)))
		    	{
		    	    SendClientMessage(playerid,MANAGEMENT, "*** Spawncolour for this player successfully set");
       				dUserSetINT(PlayerName2(pID)).("SpawnColour", colour);
			        return 1;
				}
				else return SendClientMessage(playerid, red, "A player database with that name was not found.");
			}
		}
		return 0;
	}
	else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

CMD:cookie(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 2) {
        new player1, cookies, string[128];
	    if(sscanf(params, "ui", player1, cookies)) return SendClientMessage(playerid, red, "USAGE: /cookie [playerid] [amount]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"Error: Cannot add cookies to this account as player is Level 1338 administrator!");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
		{
		    if(PlayerInfo[playerid][Registered] < 1)
		    {
		        PlayerInfo[playerid][Cookies] = PlayerInfo[playerid][Cookies]+cookies;
			}
			else
			{
            	//cookie[playerid] = dUserINT(PlayerName2(player1)).("Cookies");
            	PlayerInfo[playerid][Cookies] = dUserINT(PlayerName2(playerid)).("Cookies");
            	dUserSetINT(PlayerName2(player1)).("Cookies", PlayerInfo[playerid][Cookies]+cookies);
			}
			if(player1 != playerid)
			{
   				format(string, sizeof(string), "*** You gave %s %d cookie(s). Total: %d", pName(player1), cookies, PlayerInfo[player1][Cookies]+cookies);
 				SendClientMessage(playerid,MANAGEMENT,string);
				format(string,sizeof(string),"*** Administrator %s gave you %d cookie(s). You now have %d", pName(playerid), cookies, PlayerInfo[player1][Cookies]+cookies);
				SendClientMessage(player1,MANAGEMENT,string);
			}
			else
			{
				format(string,sizeof(string),"*** You gave yourself %d cookie(s). You now have %d", cookies, PlayerInfo[playerid][Cookies]+cookies);
				SendClientMessage(player1,MANAGEMENT,string);
			}
  			format(string, sizeof(string), "*** %s was rewarded for reporting a cheater. Total: %d", pName(player1), PlayerInfo[player1][Cookies]+cookies);
     		SendClientMessageToAll(COLOR_ORANGE, string);
			return 1;
	    } else return SendClientMessage(playerid,red,"Error: This player is not connected!");
	} else return 0;
}

CMD:bank(playerid,params[]) {

	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
        new string[128], moneys;
        new cash = GetPlayerMoney(playerid);
        bank[playerid] = dUserINT(PlayerName2(playerid)).("Bank");
        if(sscanf(params, "i", moneys)) return SendClientMessage(playerid, red, "USAGE: /bank [amount]");
		if(PlayerInfo[playerid][xAccount] == 0)
		{
			if(!IsPlayerInArea(playerid, -37.5373, -57.7987, -17.3782, -48.4518))
			{
		    	SendClientMessage(playerid,red,"Error: You need to be in the bank to deposit!");
			}
			if(moneys + bank[playerid] > MAX_ACCOUNT_MONEY) return SendClientMessage(playerid,red,"Your bank can only hold $200,000,000");
			PlayerInfo[playerid][Bank] = dUserINT(PlayerName2(playerid)).("Bank");
			return 1;
		}
		if(moneys > cash) return SendClientMessage(playerid,red,"Error: Hey! You don't have that much money!");
        if(moneys < 1) return SendClientMessage(playerid,red,"Cannot bank less than $1!");
		if(moneys + bank[playerid] > MAX_XACCOUNT_DOSH) return SendClientMessage(playerid, red, "You cannot bank this much as it would exceed your bank limit of $450,000,000!");

        dUserSetINT(PlayerName2(playerid)).("Bank", bank[playerid]+moneys);
        GivePlayerMoney(playerid, 0-moneys);
        format(string, sizeof(string), "* You have deposited $%d, your current balance is $%d.", moneys, bank[playerid]+moneys);
        SendClientMessage(playerid, MANAGEMENT, string);
        PlayerInfo[playerid][Bank] = dUserINT(PlayerName2(playerid)).("Bank");
	} else return SendClientMessage(playerid,red,"You need to be logged in to use the banking system!");
    return 1;
}

CMD:withdraw(playerid,params[])
{

	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
        new string[128], amount;
        if(sscanf(params, "i", amount)) return SendClientMessage(playerid, red, "USAGE: /withdraw [amount]");
		if(PlayerInfo[playerid][xAccount] == 0)
		{
			if(!IsPlayerInArea(playerid, -37.5373, -57.7987, -17.3782, -48.4518))
			{
		    	SendClientMessage(playerid,red,"Error: You need to be in the bank to withdraw!");
			}
		}

		PlayerInfo[playerid][Bank] = dUserINT(PlayerName2(playerid)).("Bank");
        if(amount > PlayerInfo[playerid][Bank]) return SendClientMessage(playerid,red,"Error: You don't have that much in your bank!");
		if(amount < 1) return SendClientMessage(playerid,red,"Cannot withdraw less than $1!");
        GivePlayerMoney(playerid, amount);
        dUserSetINT(PlayerName2(playerid)).("Bank", PlayerInfo[playerid][Bank]-amount);

        format(string, sizeof(string), "You have withdrawn $%d, your current balance is $%d.", amount, bank[playerid]-amount);
        SendClientMessage(playerid, MANAGEMENT, string);
	} else return SendClientMessage(playerid,red,"Error: You need to be logged in to use the banking system!");
    return 1;
}
/*
CMD:balance(playerid,params[]) {
	#pragma unused params
    if(PlayerInfo[playerid][LoggedIn] == 1) {

	} else return SendClientMessage(playerid,red,"Error: You need to be logged in to use the banking system!");
	return 1;
} */
//------------------------------------ The new taxi code from my jTaxi ----------------------------------//

CMD:settaxi(playerid, params[])
{
	new string[128], price;
	if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
	{
	    if(sscanf(params, "d", price)) return SendClientMessage(playerid, red, "USAGE: /settaxi [amount]");
		if(price > 999999999)
		{
			SendClientMessage(playerid, red, "Invalid entry - value too high.");
			return 1;
		} else {
			format(string, sizeof(string), "** %s has set the taxi price to $%d!", pName(playerid), price);
			SendClientMessageToAll(yellow, string);
			TAXI_AMOUNT = price;
		}
	} else return 0;
	return 1;
}
// -------- Secret Locations (( Restricted to Staff Levels.... usually =p))
forward InitObjsForPlayer(playerid);
public InitObjsForPlayer(playerid)
{
	TogglePlayerControllable(playerid, false);
	SendClientMessage(playerid, White, "Objects initialzing, please wait...");
	SetTimerEx("ObjsAreInit",4000, 0, "i", playerid);
	return 1;
}
forward ObjsAreInit(playerid);
public ObjsAreInit(playerid)
{
	TogglePlayerControllable(playerid, true);
	SendClientMessage(playerid, White, "Objects have been initialized! Thankyou for your patience,");
	PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
	return 1;
}
// ------------ Classified Area Commands/Functions -------------

CMD:return(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][Level] >= 2)
	    {
	        if(AdminWorld[playerid] != 0)
			{
			    AdminWorld[playerid] = 0;
			    SetPlayerRandomSpawn(playerid);
			    SetPlayerVirtualWorld(playerid, 0);
			    SendClientMessage(playerid, MANAGEMENT, "You have been respawned in the main world.");
			}
			else
			{
			    SendClientMessage(playerid, Red, "ERROR: You are not able to use this command at this moment in time.");
			}
		}
		else
		{
		    return 0;
		}
	}
	else
	{
		return 0;
	}
	return 1;
}

#if INIT_MAP_BDESERT == 1
CMD:pp(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][Level] >= 3)
		{
		    SetPosAndAngle(playerid, 4016.3882,232.4640,20.9957, 201);
			InitObjsForPlayer(playerid);
			SendClientMessage(playerid, White, "Successfully teleported to {5f7c3d}PhiBon Island. (Admin Virtual World)");
			SetPlayerVirtualWorld(playerid, 311287);
			AdminWorld[playerid] = 4;
		}
		else
		{
			return 0;
		}
	}
	return 1;
}
#endif

#if INIT_MAP_MYLAND == 1
CMD:b1(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][Level] >= 4)
	    {
	        SetPosAndAngle(playerid,-6056.30078125,1674.03491211,3.42434609,180);
	        InitObjsForPlayer(playerid);
	        SendClientMessage(playerid, White, "Successfully teleported to BASE1 {5f7c3d}(Endgame Code: B1)");
            SetPlayerVirtualWorld(playerid, 311287);
			AdminWorld[playerid] = 1;
		}
		else
		{
		    return 0;
		}
	}
	return 1;
}
#endif

CMD:ahq(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][Level] >= 2)
	    {
	        SetPosAndAngle(playerid, 414.4385,2532.2263,19.1514,90.3141);
	        SendClientMessage(playerid, MANAGEMENT, "* You have been teleported to Administration Headquarters.");
            AdminWorld[playerid] = 2;
		}
		else
		{
		    return 0;
		}
	}
	return 1;
}

CMD:ahq2(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][Level] >= 2)
	    {
	        Streamer_UpdateEx(playerid, 775.7128,-2852.9648,5.6095);
			SetPosAndAngle(playerid, 775.7128,-2852.9648,5.6095,3.2828);
			SetPlayerVirtualWorld(playerid, 311287);
			AdminWorld[playerid] = 3;
 			SendClientMessage(playerid, MANAGEMENT, "* You have been teleported to the Administration Island. Use /ahq2 again to get back.");
		}
		else
		{
		    return 0;
		}
	}
	return 1;
}
// end of classified shiznit

CMD:taxi(playerid, params[])
{
	new string[128], taxi;
	new t=GetNearestAmmunation(playerid);
	new money = GetPlayerMoney(playerid);

	if(sscanf(params, "i", taxi)) return SendClientMessage(playerid, red, "USAGE: /taxi [location] || Tip: See /locations for taxi ID's!");
	if(PlayerTaxi[playerid] == 1) return SendClientMessage(playerid, red, "You have recently taken a taxi, try again in a few minutes!");
    #if CHRISTMAS_BUILD == 1
		if(taxi < 0 || taxi > 16) return SendClientMessage(playerid, red, "** Invalid location ID. See /locations for more!");
	#else
	    if(taxi < 0 || taxi > 15) return SendClientMessage(playerid, red, "** Invalid location ID. See /locations for more!");
	#endif
	if(money < TAXI_AMOUNT) // You got the cash?
	{// No?! .. go kill some people -.-
		format(string,sizeof(string), "** You need $%d to use the taxi service!", TAXI_AMOUNT);
	 	return SendClientMessage(playerid, red, string);
	}
	if(!IsPlayerAdmin(playerid) && PlayerInfo[playerid][Level] < 2)
	{
	    TakePlayerMoney(playerid, TAXI_AMOUNT);
		PlayerTaxi[playerid] = 1;
		SetTimerEx("AllowTaxi", TAXI_WAIT_TIME, 0, "i", playerid);
	}

	switch (taxi)
	{
		case 0:
		{
			SetPosAndAngle(playerid,2010.7327,1544.8715,12.1507,270.9289);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at the Pirate Ship!");
		}
		case 1:
		{
			SetPosAndAngle(playerid,2336.6838,2454.3574,14.9688,91.2667);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at LVPD!");	// Won't be called
		}
		case 2:
		{
			SetPosAndAngle(playerid,202.7167,1886.8885,17.6481,182.6907);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at Area 51!");// Will be called
		}
		case 3:
		{
			SetPosAndAngle(playerid,-309.9432,1535.1625,75.5625,181.4176);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at the Big Ear!");// Will be called
		}
		case 4:
		{
			SetPosAndAngle(playerid,TaxiAmmu[t][0],TaxiAmmu[t][1],TaxiAmmu[t][2],TaxiAmmu[t][3]);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at the nearest Ammunation!");// Will be called
		}
		case 5:
		{
		    SetPosAndAngle(playerid,1716.7792,1615.3776,10.1187,163.7679);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at Las Venturas Airport!");// Will be called
		}
		case 6:
		{
		    SetPosAndAngle(playerid,829.5131,-1102.0778,24.3906,269.1073);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at Los Santos Cemetary!");// Will be called
		}
		case 7:
		{
		    SetPosAndAngle(playerid,1548.2565,-1681.6492,13.5589,89.7701);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at Los Santos Police Dpt.!");// Will be called
		}
		case 8:
		{
		    SetPosAndAngle(playerid,-2237.9795,-1711.6925,480.8697,186.2776);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at Mt. Chilliad!");// Will be called
		}
		case 9:
		{
		    SetPosAndAngle(playerid,-1604.8733,719.3845,11.8467,1.3372);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at San Fierro Police Dpt.!");// Will be called
		}
		case 10:
		{
		    SetPosAndAngle(playerid,2495.4402,-1687.5314,13.5162,358.3232);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at Grove St.!");// Will be called
		}
		case 11:
		{
		    SetPosAndAngle(playerid,1580.9808,-1319.0320,16.4757,180.1589);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at Los Santos Basejumping!");// Will be called
		}
		case 12:
		{
		    SetPosAndAngle(playerid,1280.2300,-819.9413,84.1406,181.1318);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at Madd Dogg's Mansion!");// Will be called
		}
		case 13:
		{
		    SetPosAndAngle(playerid,-1935.1154,-1785.7644,31.4986,190.3744);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at the San Fierro Dump!");// Will be called
		}
		case 14:
		{
		    SetPosAndAngle(playerid,-2619.0850,1412.1327,7.0938,178.4567);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at Jizzy's Niteclub!");// Will be called
		}
		case 15:
		{
		    SetPosAndAngle(playerid,2645.5593,-2011.8480,13.5547,1.7926);
			SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off at Loco Lo-Co!");// Will be called
		}
		#if CHRISTMAS_BUILD == 1
		case 16:
		{
		    SetPosAndAngle(playerid, 1126.8915,-1546.9026,22.7503,359.6044);
		    SendClientMessage(playerid, yellow, "San Andreas Cabs has dropped you off the Christmas Tree!");
		}
		#endif
	}
	return 1;
}

CMD:locations(playerid, params[])
{
    #pragma unused params
    new string[128];
    format(string, sizeof(string),"** For $%d you can take a /taxi to the following locations. **", TAXI_AMOUNT);
	SendClientMessage(playerid,White, string);
	SendClientMessage(playerid,White,"------------------------------------------");
    SendClientMessage(playerid,green,"[0]Pirate Ship,	[1]LVPD, 	[2]Area 51, 	[3]The Big Ear");
    SendClientMessage(playerid,green,"[4]Ammunation, 	[5]LVA      [6]LS Cemetary  [7]LSPD");
    SendClientMessage(playerid,green,"[8]Mt. Chilliad   [9]SFPD     [10]Grove St.   [11]LS Basejumping");
    SendClientMessage(playerid,green,"[12]Madd Doggs    [13]SF Dump [14]Jizzy's 	[15]Loco Lo Co.");
    #if CHRISTMAS_BUILD == 1
        SendClientMessage(playerid,green,"[16]Christmas Tree");
	#endif
	SendClientMessage(playerid,White,"------------------------------------------");
	return 1;
}

CMD:buychute(playerid,params[])
{
	#pragma unused params

	if(IsPlayerVIP(playerid))
 	{
        new cash = GetPlayerMoney(playerid);
        if(cash < 5000)
		{
            SendClientMessage(playerid, red, "You need $5,000 for this command!");
            return 1;
        }

        if(Basejumper[playerid] == 1) {
			GivePlayerMoney(playerid,-5000);
			GivePlayerWeapon(playerid,46,1);
			SendClientMessage(playerid,MANAGEMENT,"*** You have successfully bought a parachute for the jump!");
			Basejumper[playerid] = 0;
			return 1;
		} else return SendClientMessage(playerid,red,"Error: Either you're not at the basejump tower or you have already used this command!");
	} else if(PlayerInfo[playerid][Level] < 1) {
            SendClientMessage(playerid,red,"Error: This command is for V.I.P.'s only!");
            Basejumper[playerid] = 0;
	} return 1;
}

//------------------------------------- Tuning ------------------------------------------//

CMD:tune(playerid,params[]) {

    if(IsAtTune[playerid] == 0) {
        new tune;
	    if(sscanf(params, "i", tune)) return SendClientMessage(playerid, red, "USAGE: /tune 1-3");

		new cash = GetPlayerMoney(playerid);
        if(cash < 40000){
            SendClientMessage(playerid, red, "You need $40,000 for this command!");
            return 1;
        }

	    if(IsPlayerInAnyVehicle(playerid)) {
            if(tune == 1) {
                new PlayerVehicle = GetPlayerVehicleID(playerid);
				SetVehiclePos(PlayerVehicle,-2697.2759,217.8760,3.9068); SetVehicleZAngle(PlayerVehicle,90.2504);
				GivePlayerMoney(playerid,-40000);
				SendClientMessage(playerid,MANAGEMENT,"*** Successfully teleported to Wheel Arch Angels!");
				IsAtTune[playerid] = 1;
				return 1;
			}
			else if(tune == 2) {
                new PlayerVehicle = GetPlayerVehicleID(playerid);
				SetVehiclePos(PlayerVehicle,-1935.6700,230.6568,33.8833); SetVehicleZAngle(PlayerVehicle,0.1935);
				GivePlayerMoney(playerid,-40000);
				SendClientMessage(playerid,MANAGEMENT,"*** Successfully teleported to Transfender!");
                IsAtTune[playerid] = 1;
                return 1;
			}
			else if(tune == 3) {
                new PlayerVehicle = GetPlayerVehicleID(playerid);
				SetVehiclePos(PlayerVehicle,2644.9595,-2027.1237,13.2739); SetVehicleZAngle(PlayerVehicle,179.2948);
				GivePlayerMoney(playerid,-40000);
				SendClientMessage(playerid,MANAGEMENT,"*** Successfully teleported to Loco Low Co!");
				IsAtTune[playerid] = 1;
				return 1;
			}
			else return SendClientMessage(playerid,red,"Wrong location. 1 - Wheel Arch Angels. 2 - Transfender. 3 - Loco Low Co.");
		} else return SendClientMessage(playerid,red,"Error: You need to be in a car to tune it!");
	} else return SendClientMessage(playerid,red,"Error: You're already at a tuning garage type /back to go back!");
}

CMD:back(playerid,params[]) {
	#pragma unused params

	if(IsAtTune[playerid] == 1) {
        if(IsPlayerInAnyVehicle(playerid)) {
            new PlayerVehicle = GetPlayerVehicleID(playerid);
	        SetVehiclePos(PlayerVehicle,1150.8104,-1229.2872,16.6304); SetVehicleZAngle(PlayerVehicle,180);
	        SendClientMessage(playerid,MANAGEMENT,"*** Welcome back!");
	        return IsAtTune[playerid] = 0;
		} else return SendClientMessage(playerid,red,"Error: You're not in a car!");
	} else return SendClientMessage(playerid,red,"Error: You're not at a /tune area!");
}

//-------------------------------------- End of /tuning -------------------------------------------------//

CMD:setinterior(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
	    new player1, time, string[128];
	    if(sscanf(params, "ui", player1, time)) return SendClientMessage(playerid, red, "USAGE: /setinterior [playerid] [interior]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			format(string, sizeof(string), "You have set %s's interior to %d", pName(player1), time); SendClientMessage(playerid,MANAGEMENT,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has set your interior to %d", pName(playerid), time); SendClientMessage(player1,MANAGEMENT,string); }
   			return SetPlayerInterior(player1, time);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:eject(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
	    new player1, string[128];
	    if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /eject [playerid]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			if(IsPlayerInAnyVehicle(player1))
			{
				if(player1 != playerid)
				{
					format(string,sizeof(string),"Administrator %s has ejected you from your vehicle", pName(playerid) ); SendClientMessage(player1,MANAGEMENT,string);
				}
				format(string,sizeof(string),"You have ejected %s from their vehicle", pName(player1)); SendClientMessage(playerid,MANAGEMENT,string);
				return RemovePlayerFromVehicle(playerid);
			} else return SendClientMessage(playerid,red,"ERROR: Player is not in a vehicle");
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}


CMD:givelicence(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {

		new player1, string[128];
		if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /givelicence [playerid]");

		if(dUserINT(PlayerName2(player1)).("Licence") > 0) return SendClientMessage(playerid, red, "Error: Player already has vehicle licence!");

		format(string,sizeof(string),"*** %s has given you a vehicle licence!", pName(playerid));
		format(string,sizeof(string)," *** You gave %s a vehicle licence",pName(player1));
		SendClientMessage(playerid,MANAGEMENT,string);
		SendClientMessage(player1,MANAGEMENT,string);
		dUserSetINT(PlayerName2(player1)).("Licence",1);
        PlayerInfo[player1][Licence] = dUserINT(PlayerName2(player1)).("Licence");
		return 1;
	} else return 0;
}

CMD:dban(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {

		new player1, string[128];
		if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /dban [playerid]");

		if(dUserINT(PlayerName2(player1)).("Licence") < 1) return SendClientMessage(playerid, red, "Error: Player doesn't have the vehicle licence!");

		format(string,sizeof(string),"*** %s has revoked your vehicle licence! Talk to admins with @ [text] to find out why.", pName(playerid));
		format(string,sizeof(string)," *** You revoked %s's vehicle licence",pName(player1));
		SendClientMessage(playerid,MANAGEMENT,string);
		SendClientMessage(player1,MANAGEMENT,string);
		dUserSetINT(PlayerName2(player1)).("Licence",0);
        PlayerInfo[player1][Licence] = dUserINT(PlayerName2(player1)).("Licence");
		return 1;
	} else return 0;
}

CMD:teleban(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
		new player1, string[128];
		if(sscanf(params, "u", player1)) return SendClientMessage(playerid,red,"USAGE: /teleban [playerid]");
		if(TeleBan[player1] == 1) return SendClientMessage(playerid,red,"** Player already has a teleporting ban!");

		format(string,sizeof(string),"*** %s has banned you from using teleports!", PlayerName2(playerid));
		format(string,sizeof(string),"** You have removed %s's teleportation rights.", PlayerName2(player1));
		format(string,sizeof(string),"** %s revoked %s's teleportation rights.", PlayerName2(playerid), PlayerName2(player1));
		SendClientMessage(playerid,MANAGEMENT,string);
		SendClientMessage(player1,red,string);
		MessageToAdminsEx(playerid,red,string);
		TeleBan[player1] = 1;
		return 1;
	} else return 0;
}

CMD:givetele(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
		new player1, string[128];
		if(sscanf(params, "u", player1)) return SendClientMessage(playerid,red,"USAGE: /givetele [playerid]");
		if(TeleBan[player1] == 0) return SendClientMessage(playerid,red,"** Player already has teleporting rights!");

		format(string,sizeof(string),"*** %s has given you teleport rights!", PlayerName2(playerid));
		format(string,sizeof(string),"** You have given %s teleportation rights.", PlayerName2(player1));
		format(string,sizeof(string),"** %s gave %s teleportation rights.", PlayerName2(playerid), PlayerName2(player1));
		SendClientMessage(playerid,MANAGEMENT,string);
		SendClientMessage(player1,red,string);
		MessageToAdminsEx(playerid,red,string);
		TeleBan[player1] = 0;
		return 1;
	} else return 0;
}

CMD:burn(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 2) {
	    new player1, string[128], Float:x, Float:y, Float:z;
	    if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /burn [playerid]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
		if(NewbieSpawnDone[playerid] == 0) return SendClientMessage(playerid, Red, "* WARNING: This player is still under newbie protection!");
		if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			format(string, sizeof(string), "You have burnt %s ", pName(player1)); SendClientMessage(playerid,MANAGEMENT,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has burnt you", pName(playerid)); SendClientMessage(player1,MANAGEMENT,string); }
			GetPlayerPos(player1, x, y, z);
			return CreateExplosion(x, y , z + 3, 1, 10);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:spawn(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
		new player1, string[128];
	    if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /spawn [playerid]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			CMDMessageToAdmins(playerid,"SPAWN");
			format(string, sizeof(string), "You have spawned %s", pName(player1)); SendClientMessage(playerid,MANAGEMENT,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has spawned you", pName(playerid)); SendClientMessage(player1,MANAGEMENT,string); }
			return SpawnPlayer(player1);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:pfix(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 2) {
	    new player1, string[128];
	    if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /pfix [playerid]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			if(player1 != playerid) { format(string, sizeof(string), "You have fixed %s", pName(player1)); SendClientMessage(playerid,MANAGEMENT,string); }
			if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has fixed your account", pName(playerid)); SendClientMessage(player1,MANAGEMENT,string); }
            ClearAnimations(player1);
            SetPlayerVirtualWorld(player1,0);
            SetPlayerInterior(player1,0);
            new killed = GetPlayerMoney(player1); new wanted = GetPlayerWantedLevel(player1);
            SpawnPlayer(player1); SetPlayerScore(player1,killed); SetPlayerWantedLevel(player1,wanted);
			return TogglePlayerControllable(playerid,true);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:skip(playerid,params[]) {
    #pragma unused params

	if(PlayerInfo[playerid][Level] >= 2) {
        weatherchange();
    } else return 0;
    return 1;
}

CMD:disarm(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
	    new player1, string[128];
	    if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /disarm [playerid]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			format(string, sizeof(string), "You have disarmed %s", pName(player1)); SendClientMessage(playerid,MANAGEMENT,string);
			if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has disarmed you", pName(playerid)); SendClientMessage(player1,MANAGEMENT,string); }
            ResetPlayerWeapons(player1);
			return 1;
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:crash(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 4) {
	    new player1, string[128], Float:X,Float:Y,Float:Z;
	    if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /crash [playerid]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
	        GetPlayerPos(playerid,X,Y,Z);
            SetPlayerVelocity(playerid,X,Y,Z);
			format(string, sizeof(string), "You have crashed %s's game", pName(player1) );
			return SendClientMessage(playerid,blue, string);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:ip(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 2) {
	    new player1, string[128];
	    if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /ip [playerid]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			new tmp3[50]; GetPlayerIp(player1,tmp3,50);
			format(string,sizeof(string),"%s's current IP Address is %s", pName(player1), tmp3);
			return SendClientMessage(playerid,blue,string);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:bankrupt(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 4) {
	    new player1, string[128];
	    if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /bankrupt [playerid]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			format(string, sizeof(string), "You have bankrupted %s. Their bank balance is now $0.00", pName(player1)); SendClientMessage(playerid,MANAGEMENT,string);
   			return dUserSetINT(PlayerName2(player1)).("Bank",0);
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:ubound(playerid,params[])
{
 	if(PlayerInfo[playerid][Level] >= 3)
 	{
 	    new string[128], player1;
		if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /ubound [playerid]");
	 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			SetPlayerWorldBounds(player1, 9999.9, -9999.9, 9999.9, -9999.9 );
			format(string, sizeof(string), "Administrator %s has removed your world boundaries", PlayerName2(playerid)); if(player1 != playerid) SendClientMessage(player1,MANAGEMENT,string);
			format(string,sizeof(string),"You have removed %s's world boundaries", PlayerName2(player1));
			return SendClientMessage(playerid,MANAGEMENT,string);
		} else return SendClientMessage(playerid, red, "Player is not connected");
	} return 0;
}

CMD:commands(playerid,params[])
{
	#pragma unused params
	if(PlayerInfo[playerid][LoggedIn] && PlayerInfo[playerid][Level] >= 2)
	{
		SendClientMessage(playerid,MANAGEMENT,"--== [ LSX Help ] ==--");
		SendClientMessage(playerid,blue, "For admin commands type:  /ahelp");
		SendClientMessage(playerid,blue, "Account commands are: /register, /login, /changepass, /stats, /resetstats.  Also  /time, /report");
		SendClientMessage(playerid,blue, "There are 4 levels in crew, plus 1338 Level owners. Level 1338 crew are immune from commands");
		SendClientMessage(playerid,blue, "Level 1 is V.I.P. For full information on Levels, see the forums for the \"Levels explained\" guide.");
	}
	else if(PlayerInfo[playerid][LoggedIn] && PlayerInfo[playerid][Level] < 2)
	{
	 	SendClientMessage(playerid,green, "*** /register, /login, /report, /stats, /time, /changepass, /resetstats, /getid");
		SendClientMessage(playerid,green, "*** /tp /ctp /dive /cardive /taxi /admins /brb /afk");
    }
	else if(PlayerInfo[playerid][LoggedIn] == 0)
	{
 		SendClientMessage(playerid,green, "*** Your commands are: /time, /getid     (You are not logged in, log in for more commands)");
	} return 1;
}

CMD:ahelp(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 2)
	{
		SendClientMessage(playerid,blue,"---= All Admin Commands =---");
		SendClientMessage(playerid,lightblue," /vip, /level2, /level3, /level4, /level5, /rcon lsx");
	}
	return 1;
}

CMD:vip(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 1)
	{
		SendClientMessage(playerid,blue,"---= V.I.P. Commands =---");
		SendClientMessage(playerid,lightblue,"As a V.I.P. you have access to a larger range of commands then a regular player, these include:");
		SendClientMessage(playerid,MANAGEMENT,"/buychute, /nos, /countdown");
		SendClientMessage(playerid,lightblue,"You also have access to the V.I.P. chat with '#[text]'");
		SendClientMessage(playerid,lightblue,"Access to the V.I.P. Lounge, the V.I.P. vehicles the IRC Chat channel");
		SendClientMessage(playerid,lightblue,"and access to the V.I.P Boards on the Forum where you can give us suggestions and idea's.");
		SendClientMessage(playerid,lightblue,"We thank you for donating to Los Santos Xtreme and we hope you enjoy your time with us.");
		SendClientMessage(playerid,lightblue,"See the forums for full information on V.I.P. features");
	} else return 0;
	return 1;
}

CMD:level2(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 2)
	{
		SendClientMessage(playerid,MANAGEMENT,"---= Moderator Commands =---");
		SendClientMessage(playerid,lightblue,"/burn, /pfix, /skip, /ip, /level2, /getinfo, /specfc, /fct, /vr, /atune, /xcar, /xbike, /xheli, /xboat, /xplane,");
		SendClientMessage(playerid,lightblue,"/ping, /announce2, /flip, /goto, /warn, /kick, /ban, /unban, /slap, /whatskin, /handofgod, /jail, /unjail, /jailed,");
		SendClientMessage(playerid,lightblue,"/freeze, /unfreeze, /frozen, /mute, /unmute, /muted, /weaps, /screen, /laston, /morning, /adminarea, /reported,");
		SendClientMessage(playerid,lightblue,"/richlist, /miniguns, /spec, /specvehicle, specoff, /saveplace, /gotoplace, /write");
	}
	return 1;
}

CMD:level3(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 3)
	{
		SendClientMessage(playerid,MANAGEMENT,"    ---= Level 3 Admin Commands =---");
		SendClientMessage(playerid,lightblue,"/giveweapon, /spawnweapon, /sethealth, /setarmour, /setcash, /setscore, /setskin, /setwanted, /setname, /setcolour,");
		SendClientMessage(playerid,lightblue,"/colours, /setweather, /settime, /setworld, /antihack, /setinterior, /force, /eject, /lockcar, /unlockcar, /spawn,");
		SendClientMessage(playerid,lightblue,"/disarm, /bankrupt, /sbankrupt, /ubound, /level3, /xconfig, /locknload, /clearfc, /duel, /fillmeup, /repair, /fix,");
		SendClientMessage(playerid,lightblue,"/hydro, /car, /carhealth, /carcolour, /asay, /setping, /highlight, /announce, /xslowmo, /dc, /destroycar, /despawn,");
		SendClientMessage(playerid,lightblue,"/wsync, wdesync, /xtc, /warp, /teleplayer, /vgoto, /vget, /cookie, /gotopos, /givecar, /get, /fu, /explode, /akill,");
		SendClientMessage(playerid,lightblue,"/aka, /antifall, /fcblockon, /fcblockoff, /fcopen, fcclose, /shipgon, shipgoff, /disablechat, /clearchat, ");
		SendClientMessage(playerid,lightblue,"/clearallchat, /caps, /move, /moveplayer, /carebreak, /fakedeath, /fakechat, /xmenu, /xweather, /xtime, /cm, /xtmenu,");
        SendClientMessage(playerid,lightblue,"/xweapons, /xvehicle, /setpass, /resetstats, /xtc 2-13, /lp");
	}
	return 1;
}

CMD:level4(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 4)
	{
		SendClientMessage(playerid,MANAGEMENT,"    ---= Level 4 Admin Commands =---");
		SendClientMessage(playerid,lightblue,"/setmytime, /crash, /level4, /disable, /enable, /god, /godcar, /die, /jetpack, /unbanip, /rban, /nametags, /markers,");
		SendClientMessage(playerid,lightblue,"/settemplevel, /uconfig, /botcheck, /lockserver, /unlockserver, /password, /forbidname, /forbidword, /spawnall,");
		SendClientMessage(playerid,lightblue,"/muteall, /unmuteall, /getall, /healall, /armourall, killall, /freezeall, unfreezeall, /kickall, /slapall,");
		SendClientMessage(playerid,lightblue,"/explodeall, /disarmall, /ejectall, /setallskin, /setallwanted, /setallweather, /setalltime, /setallworld,");
        SendClientMessage(playerid,lightblue,"/setallscore, /setallcash, /giveallcash, /giveallweapon");
	}
	return 1;
}

CMD:level5(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 5)
	{
		SendClientMessage(playerid,MANAGEMENT,"    ---= Level 5 Management Commands =---");
		SendClientMessage(playerid,lightblue,"/level5, /sgod, /setgravity, /regupdate, /setvip, /delvip, /setlevel, /pickup, /object, /fakecmd, /spam, /loadsfs,");
        SendClientMessage(playerid,lightblue,"/unloadfs, /changemode, /gmx");
	}
	return 1;
}

CMD:xconfig(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 3 || PlayerInfo[playerid][Developer] == 1)
	{
	    new string[128];
		SendClientMessage(playerid,MANAGEMENT,"    ---=== LSX Configuration ===---");
		format(string, sizeof(string), "Max Ping: %dms | ReadPms %d | ReadCmds %d | Max Admin Level %d | AdminOnlySkins %d", ServerInfo[MaxPing],  ServerInfo[ReadPMs],  ServerInfo[ReadCmds],  ServerInfo[MaxAdminLevel],  ServerInfo[AdminOnlySkins] );
		SendClientMessage(playerid,MANAGEMENT,string);
		format(string, sizeof(string), "AdminSkin1 %d | AdminSkin2 %d | NameKick %d | AntiBot %d | AntiSpam %d | AntiSwear %d", ServerInfo[AdminSkin], ServerInfo[AdminSkin2], ServerInfo[NameKick], ServerInfo[AntiBot], ServerInfo[AntiSpam], ServerInfo[AntiSwear] );
		SendClientMessage(playerid,MANAGEMENT,string);
		format(string, sizeof(string), "NoCaps %d | Locked %d | Pass %s | SaveWeaps %d | SaveMoney %d | ConnectMessages %d | AdminCmdMsgs %d", ServerInfo[NoCaps], ServerInfo[Locked], ServerInfo[Password], ServerInfo[GiveWeap], ServerInfo[GiveMoney], ServerInfo[ConnectMessages], ServerInfo[AdminCmdMsg] );
		SendClientMessage(playerid,MANAGEMENT,string);
		format(string, sizeof(string), "AutoLogin %d | MaxMuteWarnings %d | ChatDisabled %d | MustLogin %d | MustRegister %d", ServerInfo[AutoLogin], ServerInfo[MaxMuteWarnings], ServerInfo[DisableChat], ServerInfo[MustLogin], ServerInfo[MustRegister] );
		SendClientMessage(playerid,MANAGEMENT,string);
	}
	return 1;
}

CMD:getinfo(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid))
	{
        new player1, string[128];
	    if(sscanf(params, "u", player1)) return SendClientMessage(playerid,red,"USAGE: /getinfo [playerid]");
	 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
		{
		    new Float:player1health, Float:player1armour, playerip[128], Float:x, Float:y, Float:z, tmp2[256], file[128],
				year, month, day, P1Jailed[4], P1Frozen[4], P1Logged[4], P1Register[4], RegDate[256], TimesOn;

			GetPlayerHealth(player1,player1health);
			GetPlayerArmour(player1,player1armour);
	    	GetPlayerIp(player1, playerip, sizeof(playerip));
	    	GetPlayerPos(player1,x,y,z);
			getdate(year, month, day);
			format(file,sizeof(file),"/lsx/users/%s.sav",udb_encode(PlayerName2(player1)));

			if(PlayerInfo[player1][Jailed] == 1) P1Jailed = "Yes"; else P1Jailed = "No";
			if(PlayerInfo[player1][Frozen] == 1) P1Frozen = "Yes"; else P1Frozen = "No";
			if(PlayerInfo[player1][LoggedIn] == 1) P1Logged = "Yes"; else P1Logged = "No";
			if(fexist(file)) P1Register = "Yes"; else P1Register = "No";
			if(dUserINT(PlayerName2(player1)).("LastOn")==0) tmp2 = "Never"; else tmp2 = dini_Get(file,"LastOn");
			if(strlen(dini_Get(file,"RegisteredDate")) < 3) RegDate = "n/a"; else RegDate = dini_Get(file,"RegisteredDate");
			TimesOn = dUserINT(PlayerName2(player1)).("TimesOnServer");

		    new Sum, Average, w;
			while (w < PING_MAX_EXCEEDS)
			{
				Sum += PlayerInfo[player1][pPing][w];
				w++;
			}
			Average = (Sum / PING_MAX_EXCEEDS);

	  		format(string, sizeof(string),"(Player Info)  ---====> Name: %s  ID: %d <====---", PlayerName2(player1), player1);
			SendClientMessage(playerid,lightblue,string);
		  	format(string, sizeof(string),"Health: %d  Armour: %d  Score: %d  Cash: %d  Skin: %d  IP: %s  Ping: %d  Average Ping: %d",floatround(player1health),floatround(player1armour),
			GetPlayerScore(player1),GetPlayerMoney(player1),GetPlayerSkin(player1),playerip,GetPlayerPing(player1), Average );
			SendClientMessage(playerid,red,string);
			format(string, sizeof(string),"Interior: %d  Virtual World: %d  Wanted Level: %d  X %0.1f  Y %0.1f  Z %0.1f", GetPlayerInterior(player1), GetPlayerVirtualWorld(player1), GetPlayerWantedLevel(player1), Float:x,Float:y,Float:z);
			SendClientMessage(playerid,orange,string);
			format(string, sizeof(string),"Times On Server: %d  Kills: %d  Deaths: %d  Ratio: %0.2f  AdminLevel: %d", TimesOn, PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:PlayerInfo[player1][Deaths], PlayerInfo[player1][Level] );
			SendClientMessage(playerid,yellow,string);
			format(string, sizeof(string),"Registered: %s  Logged In: %s  In Jail: %s  Frozen: %s", P1Register, P1Logged, P1Jailed, P1Frozen );
			SendClientMessage(playerid,green,string);
			format(string, sizeof(string),"Last On Server: %s  Register Date: %s  Todays Date: %d/%d/%d", tmp2, RegDate, day,month,year );
			SendClientMessage(playerid,MANAGEMENT,string);

			if(IsPlayerInAnyVehicle(player1))
			{
				new Float:VHealth, carid = GetPlayerVehicleID(playerid); GetVehicleHealth(carid,VHealth);
				format(string, sizeof(string),"VehicleID: %d  Model: %d  Vehicle Name: %s  Vehicle Health: %d",carid, GetVehicleModel(carid), VehicleNames[GetVehicleModel(carid)-400], floatround(VHealth) );
				SendClientMessage(playerid,COLOR_BLUE,string);
			}

			new slot, ammo, weap, Count, WeapName[24], WeapSTR[128], p; WeapSTR = "Weaps: ";
			for (slot = 0; slot < 14; slot++) {	GetPlayerWeaponData(player1, slot, weap, ammo); if( ammo != 0 && weap != 0) Count++; }
			if(Count < 1) return SendClientMessage(playerid,lightblue,"Player has no weapons");
			else
			{
				for (slot = 0; slot < 14; slot++)
				{
					GetPlayerWeaponData(player1, slot, weap, ammo);
					if (ammo > 0 && weap > 0)
					{
						GetWeaponName(weap, WeapName, sizeof(WeapName) );
						if (ammo == 65535 || ammo == 1) format(WeapSTR,sizeof(WeapSTR),"%s%s (1)",WeapSTR, WeapName);
						else format(WeapSTR,sizeof(WeapSTR),"%s%s (%d)",WeapSTR, WeapName, ammo);
						p++;
						if(p >= 5)
						{
							SendClientMessage(playerid, lightblue, WeapSTR); format(WeapSTR, sizeof(WeapSTR), "Weaps: "); p = 0;
						}
						else format(WeapSTR, sizeof(WeapSTR), "%s,  ", WeapSTR);
					}
				}
				if(p <= 4 && p > 0)
				{
					string[strlen(string)-3] = '.';
				    SendClientMessage(playerid, lightblue, WeapSTR);
				}
			}
			return 1;
		} else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:my(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    new mSubCommand[4], mCommand[20], m3rdCommand[20], string[128], pDeaths, h, m, s, file[MAX_PLAYER_NAME];
		if(sscanf(params, "s[20]S(4)S(20)", mCommand, mSubCommand, m3rdCommand))
	    {
	        SendClientMessage(playerid, Red, "USAGE: /my [stats,char,time,balance,cookies,object,messages,hide]");
		}
		else if(!strcmp(mCommand, "char"))
		{
		    if(!strcmp(mSubCommand, "save"))
		    {
		        new skin = GetPlayerSkin(playerid);
				dUserSetINT(PlayerName2(playerid)).("FavSkin",skin);
				SendClientMessage(playerid, MANAGEMENT, "You have successfully saved your current skin.");
			}
			if(!strcmp(mSubCommand, "load"))
			{
				if(PlayerInfo[playerid][FavSkin] != -1)
				{
					SetPlayerSkin(playerid, PlayerInfo[playerid][FavSkin]);
			    	SendClientMessage(playerid, MANAGEMENT, "You have loaded your saved skin.");
				}
				else
				{
				    SendClientMessage(playerid, Red, "You have not yet saved a skin. Use /my char save to save your current skin.");
				}
			}
		}
		else if(!strcmp(mCommand, "object"))
		{
			if(!strcmp(mSubCommand, "on"))
			{
			    if(PlayerInfo[playerid][ObjectStatus] == 1) return SendClientMessage(playerid, Red, "ERROR: Your holding object is already set to spawn!");
		        PlayerInfo[playerid][ObjectStatus] = 1;
		        SendClientMessage(playerid, MANAGEMENT, "Your holding object is now active, it will be attached everytime you spawn.");
			}
			else if(!strcmp(mSubCommand, "off"))
			{
			    if(PlayerInfo[playerid][ObjectStatus] == 0) return SendClientMessage(playerid, Red, "ERROR: Your holding object is already off!");
			    PlayerInfo[playerid][ObjectStatus] = 0;
			    SendClientMessage(playerid, MANAGEMENT, "Your holding object is no longer active. Use /my object on to activate it again.");
			}
			else
			{
			    SendClientMessage(playerid, Red, "USAGE: /my object [on/off]");
			}
		}
		else if(!strcmp(mCommand, "time"))
		{
		    if(!strcmp(mSubCommand, "on"))
		    {
		        if(PlayerInfo[playerid][MyTime] == 0)
		        {
		            PlayerInfo[playerid][MyTime] = 1;
		            ShowPlayerDialog(playerid, MYTIME_DIALOG, DIALOG_STYLE_INPUT, "Set your time!", "Choose an hour of the day to set your personal time to\n this will be saved into your database.", "Ok", "Cancel");
				}
				else
				{
				    SendClientMessage(playerid, Red, "ERROR: Your MyTime setting is already on!");
				}
			}
			else if(!strcmp(mSubCommand, "off"))
			{
			    if(PlayerInfo[playerid][MyTime] == 1)
			    {
			        PlayerInfo[playerid][MyTime] = 0;
			        PlayerInfo[playerid][MyHour] = -1;
			        SendClientMessage(playerid, MANAGEMENT, "Your time has been reset to the server time.");
				}
				else
				{
				    SendClientMessage(playerid, Red, "ERROR: Your MyTime setting is already off!");
				}
			}
			else if(!strcmp(mSubCommand, "set"))
			{
			    if(PlayerInfo[playerid][MyTime])
			    {
			        ShowPlayerDialog(playerid, MYTIME_DIALOG, DIALOG_STYLE_INPUT, "Set your time!", "Choose an hour of the day to set your personal time to\n this will be saved into your database.", "Ok", "Cancel");
				}
				else if(PlayerInfo[playerid][MyTime] == 0)
				{
				    SendClientMessage(playerid, Red, "ERROR: Your MyTime setting is currently off. First enable it with /my time on.");
				}
			}
			else
			{
			    SendClientMessage(playerid, Red, "USAGE: /my time [on/off/set]");
			}
		}
		else if(!strcmp(mCommand, "messages"))
		{
		    if(!strcmp(mSubCommand, "tele"))
		    {
		        if(!strcmp(m3rdCommand, "on"))
		        {
		            if(PlayerInfo[playerid][TeleMsg] == 0)
			        {
			            PlayerInfo[playerid][TeleMsg] = 1;
			            dUserSetINT(pName(playerid)).("TeleMsg", 1);
			            SendClientMessage(playerid, White, "You will now receive player teleport messages.");
					}
					else
					{
					    SendClientMessage(playerid, Red, "ERROR: You are already receiving player teleport messages!");
					}
				}
                if(!strcmp(m3rdCommand,"off"))
			    {
			        if(PlayerInfo[playerid][TeleMsg])
			        {
			            PlayerInfo[playerid][TeleMsg] = 0;
			            dUserSetINT(pName(playerid)).("TeleMsg", 0);
			            SendClientMessage(playerid, White, "You will no longer receive player teleport messages.");
					}
					else
					{
					    SendClientMessage(playerid, Red, "ERROR: You are not currently receiving player teleport messages!");
					}
				}
				else
				{
				    SendClientMessage(playerid, Red, "USAGE: /my messages tele [on/off]");
				}
			}
		}
		else if(!strcmp(mCommand, "hide"))
		{
		    if(PlayerInfo[playerid][Level] >= 3)
		    {
      			if(!strcmp(mSubCommand, "on"))
                {
					if(PlayerInfo[playerid][Hidden] == 1) return SendClientMessage(playerid, Red, "You are already invisible!");
  					for(new i; i < MAX_PLAYERS; i++)
  					{
  		    			if(IsPlayerConnected(i) && PlayerInfo[i][Level] < 3)
						{
						    ShowPlayerNameTagForPlayer(i, playerid, false);
						    SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid) & 0xFFFFFF00));
						}
					}
					format(string, sizeof(string), "%s[%d] is now hidden for players", pName(playerid), playerid);
	    			MessageToAdminsEx(playerid, MAD_WHITE, string);
	    			PlayerInfo[playerid][Hidden] = 1;
	    			SendClientMessage(playerid, MANAGEMENT, "* You are now invisible to players.");
					return 1;
				}
				else if(!strcmp(mSubCommand, "off"))
				{
					if(PlayerInfo[playerid][Hidden] == 0) return SendClientMessage(playerid, Red, "You're hide is already off!");
  					for(new i; i < MAX_PLAYERS; i++)
  					{
  		    			if(IsPlayerConnected(i) && PlayerInfo[i][Level] < 3)
						{
						    ShowPlayerNameTagForPlayer(i, playerid, false);
						    SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid)));
						}
					}
					format(string, sizeof(string), "%s[%d] is not invisible anymore.", pName(playerid), playerid);
	    			MessageToAdminsEx(playerid, MAD_WHITE, string);
	    			PlayerInfo[playerid][Hidden] = 0;
	    			SendClientMessage(playerid, MANAGEMENT, "* You are now invisible to players.");
                    return 1;
				}
				else
				{
					SendClientMessage(playerid, Red, "USAGE: /my hide [on/off]");
				}
			}
			else if(PlayerInfo[playerid][Level] == 1)
			{
				if(!strcmp(mSubCommand, "on"))
				{
				    if(PlayerInfo[playerid][Hidden] == 0)
				    {
				        PlayerInfo[playerid][Hidden] = 1;
				        SendClientMessage(playerid, COLOR_WHITE, "Nobody can teleport to you now, use /my hide off to enable it again.");
					}
				}
				if(!strcmp(mSubCommand, "off"))
				{
				    if(PlayerInfo[playerid][Hidden] == 1)
				    {
				        PlayerInfo[playerid][Hidden] = 0;
				        SendClientMessage(playerid, COLOR_WHITE, "You have enabled teleporting, players can teleport to you again.");
					}
				}
			}
			else
			{
			    return 0;
			}
		}
		else if(!strcmp(mCommand, "balance"))
		{
			if(PlayerInfo[playerid][xAccount])
			{
   				format(string, sizeof(string), "Your current balance is: $%d.0.", dUserINT(PlayerName2(playerid)).("Bank"));
				SendClientMessage(playerid, MANAGEMENT, string);
			}
  			else
	  		{
		  		SendClientMessage(playerid,red,"Upgrade to an xAccount to be able to use this command!");
			}
		}
		else if(!strcmp(mCommand,"cookies"))
		{
            SendClientMessage(playerid,MAD_WHITE,"----------------------------------------");
			format(string,sizeof(string),"You currently have %d cookies. Report more cheaters - earn more dough!", PlayerInfo[playerid][Cookies]);
			SendClientMessage(playerid,MAD_WHITE,string);
			SendClientMessage(playerid,MAD_WHITE,"----------------------------------------");
		}
		else if(!strcmp(mCommand, "stats"))
		{
		    format(file,sizeof(file),"/lsx/users/%s.sav",udb_encode(pName(playerid)));
	    	TotalGameTime(playerid, h, m, s);
 			if(PlayerInfo[playerid][Deaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[playerid][Deaths];
 			if(PlayerInfo[playerid][Kills] == 0) PlayerInfo[playerid][Deaths] = 1;
 			SendClientMessage(playerid, White, "--------------------------------");
 			format(string, sizeof(string), "Showing public statistics for %s[%d]", pName(playerid), playerid);
 			SendClientMessage(playerid, DAYTONA_YELLOW, string);
 			format(string, sizeof(string), "%s has died %d times and has killed %d players making %s's ratio %0.2f",PlayerName2(playerid), PlayerInfo[playerid][Deaths], PlayerInfo[playerid][Kills], pName(playerid), Float:PlayerInfo[playerid][Kills]/Float:pDeaths);
 			SendClientMessage(playerid, White, string);
 			format(string, sizeof(string), "The registration date for %s is %s", pName(playerid), dini_Get(file,"RegisteredDate"));
            SendClientMessage(playerid, White, string);
            SendClientMessage(playerid, White, "--------------------------------");
			return SendClientMessage(playerid, MAD_WHITE, string);
		}
		else if(!strcmp(mCommand, "quitmessage"))
		{
		    if(PlayerInfo[playerid][Level] >= 1)
		    {
		        if(strlen(dini_Get(file, "CustomMsgLeave")) < 2)
		        {
		            ShowPlayerDialog(playerid, LEAVE_MSG_DIALOG_INITIAL, DIALOG_STYLE_INPUT, "Custom Leaving Message", "Here you can enter a custom quit\nmessage that other players will see\nwhen you leave the game!", "Save", "Cancel");
				}
				else
				{
				    ShowPlayerDialog(playerid, LEAVE_MSG_DIALOG_EDIT, DIALOG_STYLE_INPUT, "Change your custom leave message.", "Enter a new quit message to show whenever\nyou leave the server; to other players.", "Save", "Cancel");
				}
			}
			else
			{
			    return 0;
			}
		}
	}
	else
	{
	    SendClientMessage(playerid, Red, "ERROR: You need to be logged in to use this command");
	}
	return 1;
}



CMD:disable(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 4 || IsPlayerAdmin(playerid)) {
        new string[128], file[128], antiswear, namekick, antispam, ping, readcmds, readpms, caps, admincmdmsgs, connectmsgs, autologin; format(file,sizeof(file),"lsx/config/Config.ini");
	    if(sscanf(params, "s[30]", antiswear || namekick || antispam || ping || readcmds || readpms || caps || admincmdmsgs || connectmsgs || autologin )) {
     		return SendClientMessage(playerid,red,"USAGE: /disable [antiswear/namekick/antispam/ping/readcmds/readpms/caps/admincmdmsgs/connectmsgs/autologin");
		}
		if(strcmp(params,"antiswear",true) == 0) {
			ServerInfo[AntiSwear] = 0;
			dini_IntSet(file,"AntiSwear",0);
			format(string,sizeof(string),"Administrator %s has disabled antiswear", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"namekick",true) == 0) {
			ServerInfo[NameKick] = 0;
			dini_IntSet(file,"NameKick",0);
			format(string,sizeof(string),"Administrator %s has disabled namekick", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
	 	} else if(strcmp(params,"antispam",true) == 0)	{
			ServerInfo[AntiSpam] = 0;
			dini_IntSet(file,"AntiSpam",0);
			format(string,sizeof(string),"Administrator %s has disabled antispam", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"ping",true) == 0)	{
			ServerInfo[MaxPing] = 0;
			dini_IntSet(file,"MaxPing",0);
			format(string,sizeof(string),"Administrator %s has disabled ping kick", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"readcmds",true) == 0) {
			ServerInfo[ReadCmds] = 0;
			dini_IntSet(file,"ReadCMDs",0);
			format(string,sizeof(string),"Administrator %s has disabled reading commands", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"readpms",true) == 0) {
			ServerInfo[ReadPMs] = 0;
			dini_IntSet(file,"ReadPMs",0);
			format(string,sizeof(string),"Administrator %s has disabled reading pms", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
  		} else if(strcmp(params,"caps",true) == 0)	{
			ServerInfo[NoCaps] = 1;
			dini_IntSet(file,"NoCaps",1);
			format(string,sizeof(string),"Administrator %s has prevented captial letters in chat", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"admincmdmsgs",true) == 0) {
			ServerInfo[AdminCmdMsg] = 0;
			dini_IntSet(file,"AdminCMDMessages",0);
			format(string,sizeof(string),"Administrator %s has disabled admin command messages", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"connectmsgs",true) == 0)	{
			ServerInfo[ConnectMessages] = 0;
			dini_IntSet(file,"ConnectMessages",0);
			format(string,sizeof(string),"Administrator %s has disabled connect & disconnect messages", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"autologin",true) == 0)	{
			ServerInfo[AutoLogin] = 0;
			dini_IntSet(file,"AutoLogin",0);
			format(string,sizeof(string),"Administrator %s has disabled auto login", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		}
		return 1;
	} return 0;
}

CMD:enable(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 4 || IsPlayerAdmin(playerid)) {
        new string[128], file[128], antiswear, namekick, antispam, ping, readcmds, readpms, caps, admincmdmsgs, connectmsgs, autologin; format(file,sizeof(file),"lsx/config/Config.ini");
	    if(sscanf(params, "s[30]", antiswear || namekick || antispam || ping || readcmds || readpms || caps || admincmdmsgs || connectmsgs || autologin )) {
			return SendClientMessage(playerid,red,"USAGE: /disable [antiswear/namekick/antispam/ping/readcmds/readpms/caps/admincmdmsgs/connectmsgs/autologin");

		}
		if(strcmp(params,"antiswear",true) == 0) {
			ServerInfo[AntiSwear] = 1;
			dini_IntSet(file,"AntiSwear",1);
			format(string,sizeof(string),"Administrator %s has enabled antiswear", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"namekick",true) == 0)	{
			ServerInfo[NameKick] = 1;
			format(string,sizeof(string),"Administrator %s has enabled namekick", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
 		} else if(strcmp(params,"antispam",true) == 0)	{
			ServerInfo[AntiSpam] = 1;
			dini_IntSet(file,"AntiSpam",1);
			format(string,sizeof(string),"Administrator %s has enabled antispam", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"ping",true) == 0)	{
			ServerInfo[MaxPing] = 800;
			dini_IntSet(file,"MaxPing",800);
			format(string,sizeof(string),"Administrator %s has enabled ping kick", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"readcmds",true) == 0)	{
			ServerInfo[ReadCmds] = 1;
			dini_IntSet(file,"ReadCMDs",1);
			format(string,sizeof(string),"Administrator %s has enabled reading commands", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"readpms",true) == 0) {
			ServerInfo[ReadPMs] = 1;
			dini_IntSet(file,"ReadPMs",1);
			format(string,sizeof(string),"Administrator %s has enabled reading pms", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"caps",true) == 0)	{
			ServerInfo[NoCaps] = 0;
			dini_IntSet(file,"NoCaps",0);
			format(string,sizeof(string),"Administrator %s has allowed captial letters in chat", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"admincmdmsgs",true) == 0)	{
			ServerInfo[AdminCmdMsg] = 1;
			dini_IntSet(file,"AdminCmdMessages",1);
			format(string,sizeof(string),"Administrator %s has enabled admin command messages", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"connectmsgs",true) == 0) {
			ServerInfo[ConnectMessages] = 1;
			dini_IntSet(file,"ConnectMessages",1);
			format(string,sizeof(string),"Administrator %s has enabled connect & disconnect messages", PlayerName2(playerid));
			MessageToAdminsEx(playerid,MANAGEMENT,string);
		} else if(strcmp(params,"autologin",true) == 0) {
			ServerInfo[AutoLogin] = 1;
			dini_IntSet(file,"AutoLogin",1);
			format(string,sizeof(string),"Administrator %s has enabled auto login", PlayerName2(playerid));
            MessageToAdminsEx(playerid,MANAGEMENT,string);
		}
		return 1;
	} return 0;
}

CMD:countdown(playerid,params[]) {
	#pragma unused params
    if(PlayerInfo[playerid][Regular] >= 1) {
        if(CountDown == -1) {
			CountDown = 6;
			SetTimer("countdown",1000,0);
			return 1;
		} else return SendClientMessage(playerid,red,"ERROR: Countdown in progress");
	} else return SendClientMessage(playerid,red,"Error: Only regular players can start a countdown.");
}

CMD:nukefc(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 3) {
            CreateExplosion(2184.9570,-1784.1903,13.3665,7,700);
            CreateExplosion(2186.6699,-1793.5065,13.3703,7,700);
            CreateExplosion(2186.9001,-1803.8132,13.3694,7,700);
            CreateExplosion(2178.5806,-1808.6385,13.3741,7,700);
            CreateExplosion(2168.9641,-1809.4653,13.3749,7,700);
            CreateExplosion(2157.6826,-1809.5648,13.3750,7,700);
            CreateExplosion(2157.0449,-1801.7670,13.3733,7,700);
            CreateExplosion(2156.8735,-1791.2787,13.3527,7,700);
			CreateExplosion(2166.4854,-1790.8929,13.5204,7,700);
			CreateExplosion(2178.8574,-1788.1471,13.5156,7,700);
			CreateExplosion(2175.9458,-1800.6245,13.3663,7,700);
			CreateExplosion(2164.8167,-1801.8213,13.3675,7,700);
            SendClientMessage(playerid,blue,"** FC cleared successfully.");
            SendClientMessageToAll(MANAGEMENT,"*** An Administrator has nuked FC");
            GameTextForAll("OWNED",4000,4);
			return 1;
    } else return 0;
}

CMD:fct(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 2) {
			SetPlayerPos(playerid,2179.3823,-1820.7634,18.8672);
			SendClientMessage(playerid,MANAGEMENT,"** Admin teleport to FC successful!");
            return 1;
    } else return 0;
}

CMD:fillmeup(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 3) {
		MaxAmmo(playerid);
		SendClientMessage(playerid,MANAGEMENT,"*** Your weapons have been maxed");
		return 1;
	} else return 0;
}

CMD:repair(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 3) {
		if(IsPlayerInAnyVehicle(playerid)) {
			GetPlayerPos(playerid,Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]);
			GetVehicleZAngle(GetPlayerVehicleID(playerid), Pos[playerid][3]);
			SetPlayerCameraPos(playerid, 1929.0, 2137.0, 11.0);
			SetPlayerCameraLookAt(playerid,1935.0, 2138.0, 11.5);
			SetVehiclePos(GetPlayerVehicleID(playerid), 1974.0,2162.0,11.0);
			SetVehicleZAngle(GetPlayerVehicleID(playerid), -90);
			SetTimerEx("RepairCar",5000,0,"i",playerid);
	    	return SendClientMessage(playerid,MANAGEMENT,"Your car will be ready in 5 seconds");
		} else return SendClientMessage(playerid,red,"Error: You are not in a vehicle");
	} else return 0;
}

CMD:nos(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 1) {
		if(IsPlayerInAnyVehicle(playerid)) {
 	        new cash = GetPlayerMoney(playerid);
			if(cash < 15000){
		        SendClientMessage(playerid, red, "You need $15.000 for this command!");
		        return 1;
	        }
			switch(GetVehicleModel( GetPlayerVehicleID(playerid) )) {
				case 448,461,462,463,468,471,509,510,521,522,523,581,586,449:
				return SendClientMessage(playerid,red,"ERROR: You can not tune this vehicle!");
			}
	        AddVehicleComponent(GetPlayerVehicleID(playerid), 1010); GivePlayerMoney(playerid,-15000);  SendClientMessage(playerid,MANAGEMENT,"You paid $15000 for 10x Nitrous Oxide");
			return PlayerPlaySound(playerid,1133,0.0,0.0,0.0);
		} else return SendClientMessage(playerid,red,"ERROR: You must be in a vehicle.");
	} else return SendClientMessage(playerid,red,"Error: Only VIP's have access to this command.");
}

// Spawn menu for players tharrrr
//CMD:sv(playerid, params[]) return CMD:spawnveh(playerid, params[]);

CMD:v(playerid, params[])
{
	if(PlayerInfo[playerid][Level] < 5 && !IsPlayerAdmin(playerid)) return 0;

	new vname[32], colour1, colour2;
	if(sscanf(params, "s[32]I(-1)I(-1)", vname, colour1, colour2)) {
		SendClientMessage(playerid, 0xFF0000FF, "USAGE: /v [ModelID/Name] (Colour 1) (Colour 2)");
		return 1;
	}

	new modelid = strval(vname);
	if(modelid > 611 || modelid < 400) {
		modelid = GetVehicleModelIDFromName(vname);
		if(modelid == -1)
		{
			SendClientMessage(playerid, Red, "Invalid Vehicle Model");
			return 1;
		}
	}

	new Float:px, Float:py, Float:pz, Float:prot;
	if(IsPlayerInAnyVehicle(playerid)) {
		GetVehiclePos(GetPlayerVehicleID(playerid), px, py, pz);
		GetVehicleZAngle(GetPlayerVehicleID(playerid), prot);
	} else {
		GetPlayerPos(playerid, px, py, pz);
		GetPlayerFacingAngle(playerid, prot);
	}

	new vid = CreateVehicle(modelid, px + 4*floatcos(prot + 90.0, degrees), py + 4*floatsin(prot + 90.0, degrees), pz, prot + 90, colour1, colour2, -1);
	if(vid == INVALID_VEHICLE_ID) {
		SendClientMessage(playerid, Red, "Vehicle limit reached");
		return 1;
	}
	LinkVehicleToInterior(vid, GetPlayerInterior(playerid));
	SetVehicleVirtualWorld(vid, GetPlayerVirtualWorld(playerid));
	DynamicV[vid] = 1;

	new string[128];
	format(string, sizeof(string), "%s successfully spawned. To destroy it, use /dc", GetVehicleName(vid));
	SendClientMessage(playerid, White, string);
	return 1;
}

CMD:dyndel(playerid,params[])
{
	if(PlayerInfo[playerid][Level] >= 4 || IsPlayerAdmin(playerid))
	{
		for(new i=0; i < MAX_VEHICLES; i++)
		{
	    	if(DynamicV[i] == 1)
	    	{
	        	DestroyVehicle(i);
	        }
		}
  		new string[128];
        format(string, sizeof(string), "%s has destroyed all dynamically created vehicles!", pName(playerid));
		SendClientMessage(playerid, MANAGEMENT, "All dynamically created vehicles have been destroyed.");
		return MessageToAdminsEx(playerid, COLOR_WHITE, string);
	} else return 0;
}


CMD:carhealth(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
		new player1, health, string[128];
	    if(sscanf(params, "ui")) return SendClientMessage(playerid, red, "USAGE: /carhealth [playerid] [amount]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
            if(IsPlayerInAnyVehicle(player1)) {
				format(string, sizeof(string), "You have set %s's vehicle health to %d", pName(player1), health); SendClientMessage(playerid,MANAGEMENT,string);
   				return SetVehicleHealth(GetPlayerVehicleID(player1), health);
			} else return SendClientMessage(playerid,red,"ERROR: Player is not in a vehicle");
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:carcolour(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
        new player1, colour1, colour2, string[128];
	    if(sscanf(params, "uii", player1, colour1, colour2)) return SendClientMessage(playerid, red, "USAGE: /carcolour [playerid] [colour1] [colour2]");
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
            if(IsPlayerInAnyVehicle(player1)) {
				format(string, sizeof(string), "You have changed the colour of %s's %s to colour ID's %d and %d", pName(player1), VehicleNames[GetVehicleModel(GetPlayerVehicleID(player1))-400], colour1, colour2 ); SendClientMessage(playerid,MANAGEMENT,string);
				if(player1 != playerid) { format(string,sizeof(string),"Administrator %s has changed the colour of your %s to colour ID's %d and %d", pName(playerid), VehicleNames[GetVehicleModel(GetPlayerVehicleID(player1))-400], colour1, colour2 ); SendClientMessage(player1,MANAGEMENT,string); }
   				return ChangeVehicleColor(GetPlayerVehicleID(player1), colour1, colour2);
			} else return SendClientMessage(playerid,red,"ERROR: Player is not in a vehicle");
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:god(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 4 || IsPlayerAdmin(playerid)) {
    	if(PlayerInfo[playerid][God] == 0)	{
   	    	PlayerInfo[playerid][God] = 1;
    	    SetPlayerHealth(playerid,100000);
			GivePlayerWeapon(playerid,16,50000); GivePlayerWeapon(playerid,26,50000);
           	SendClientMessage(playerid,green,"GODMODE ON");
			return CMDMessageToAdmins(playerid,"GOD");
		} else {
   	        PlayerInfo[playerid][God] = 0;
       	    SendClientMessage(playerid,red,"GODMODE OFF");
        	SetPlayerHealth(playerid, 100);
		} return GivePlayerWeapon(playerid,35,0);
	} return 0;
}

CMD:sgod(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid)) {
   		if(PlayerInfo[playerid][God] == 0)	{
        	PlayerInfo[playerid][God] = 1;
	        SetPlayerHealth(playerid,100000);
			GivePlayerWeapon(playerid,16,50000); GivePlayerWeapon(playerid,26,50000);
            return SendClientMessage(playerid,green,"GODMODE ON");
		} else	{
   	        PlayerInfo[playerid][God] = 0;
            SendClientMessage(playerid,red,"GODMODE OFF");
	        SetPlayerHealth(playerid, 100); return GivePlayerWeapon(playerid,35,0);
		}
	} return 0;
}

CMD:godcar(playerid,params[])
{
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 4 || IsPlayerAdmin(playerid))
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
	    	if(PlayerInfo[playerid][GodCar] == 0)
			{
        		PlayerInfo[playerid][GodCar] = 1;
   				CMDMessageToAdmins(playerid,"GODCAR");
            	return SendClientMessage(playerid,green,"GODCARMODE ON");
			}
			else
			{
	            PlayerInfo[playerid][GodCar] = 0;
    	        return SendClientMessage(playerid,red,"GODCARMODE OFF");
			}
		} else return SendClientMessage(playerid,red,"ERROR: You need to be in a car to use this command");
	} return 0;
}

CMD:die(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 4 || IsPlayerAdmin(playerid)) {
		new Float:x, Float:y, Float:z ;
		GetPlayerPos( playerid, Float:x, Float:y, Float:z );
		CreateExplosion(Float:x+10, Float:y, Float:z, 8,10.0);
		CreateExplosion(Float:x-10, Float:y, Float:z, 8,10.0);
		CreateExplosion(Float:x, Float:y+10, Float:z, 8,10.0);
		CreateExplosion(Float:x, Float:y-10, Float:z, 8,10.0);
		CreateExplosion(Float:x+10, Float:y+10, Float:z, 8,10.0);
		CreateExplosion(Float:x-10, Float:y+10, Float:z, 8,10.0);
		return CreateExplosion(Float:x-10, Float:y-10, Float:z, 8,10.0);
	} return 0;
}

CMD:getid(playerid,params[]) {
    new found, player1, string[128], playername[MAX_PLAYER_NAME];
	if(sscanf(params, "u", player1)) return SendClientMessage(playerid,blue,"Correct Usage: /getid [Player name/Partial]");
	format(string,sizeof(string),"Searched for: %s",player1);
	SendClientMessage(playerid,MANAGEMENT,string);
	for(new i=0; i <= MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
	  		GetPlayerName(i, playername, MAX_PLAYER_NAME);
			new namelen = strlen(playername);
			new bool:searched=false;
	    	for(new pos=0; pos <= namelen; pos++)
			{
				if(searched != true)
				{
					if(strfind(playername,params,true) == pos)
					{
		                found++;
						format(string,sizeof(string),"%d. %s (ID %d)",found,playername,i);
						SendClientMessage(playerid, green ,string);
						searched = true;
					}
				}
			}
		}
	}
	if(found == 0) SendClientMessage(playerid, lightblue, "No players have this in their nick");
	return 1;
}

CMD:asay(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 3)
	{
	    new msg;
 		if(sscanf(params, "s", msg)) return SendClientMessage(playerid, red, "USAGE: /asay [text]");
		new string[128]; format(string, sizeof(string), "** Admin %s: %s", PlayerName2(playerid), msg);
		return SendClientMessageToAll(COLOR_PINK,string);
	} return 0;
}

CMD:setping(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
	{
	    new string[128], ping;
 		if(sscanf(params, "i", ping)) return SendClientMessage(playerid, red, "USAGE: /setping [ping]   Set to 0 to disable");
		ServerInfo[MaxPing] = ping;
		new file[128]; format(file,sizeof(file),"lsx/config/Config.ini");
		dini_IntSet(file,"MaxPing",ping);
		for(new i = 0; i <= MAX_PLAYERS; i++) if(IsPlayerConnected(i)) PlayerPlaySound(i,1057,0.0,0.0,0.0);
		if(ping == 0) format(string,sizeof(string),"Administrator %s has disabled maximum ping", PlayerName2(playerid), ping);
		else format(string,sizeof(string),"Administrator %s has set the maximum ping to %d", PlayerName2(playerid), ping);
		return SendClientMessageToAll(MANAGEMENT,string);
	} return 0;
}

CMD:ping(playerid,params[])
{
	if(PlayerInfo[playerid][Level] >= 2)
    {
	    new player1, string[128];
	    if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /ping [playerid]");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
		{
		    new Sum, Average, x;
			while (x < PING_MAX_EXCEEDS)
			{
				Sum += PlayerInfo[player1][pPing][x];
				x++;
			}
			Average = (Sum / PING_MAX_EXCEEDS);
			format(string, sizeof(string), "%s[%d] Average Ping: %d   (Last ping readings: %d, %d, %d, %d)", PlayerName2(player1), player1, Average, PlayerInfo[player1][pPing][0], PlayerInfo[player1][pPing][1], PlayerInfo[player1][pPing][2], PlayerInfo[player1][pPing][3] );
			return SendClientMessage(playerid,MANAGEMENT,string);
		} else return SendClientMessage(playerid, red, "Player is not connected");
	} return 0;
}

CMD:setgrav(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 5)
	{
	    new gravity, string[128];
	    if(sscanf(params, "f", gravity)) return SendClientMessage(playerid, Red, "USAGE: /setgrav [-50 > 50]");
	    {
	        format(string, sizeof(string), "gravity %f", gravity); SendRconCommand(string);
	        format(string, sizeof(string), "Gravity set to %f.0", gravity); SendClientMessage(playerid, MANAGEMENT, string);
			format(string, sizeof(string), "%s has changed the gravity to %f", pName(playerid), gravity); MessageToAdminsEx(playerid, White, string);
		}
	} return 0;
}

CMD:credits(playerid,params[]) {
	#pragma unused params
	SendClientMessage(playerid,green,"LSX. Gamemode for SA:MP 0.2.x. Created by PlayLSX Development Team. Version: "#LVXVersion"");
	SendClientMessage(playerid,green,"Main credits: LethaL for foundation of administration.");
	SendClientMessage(playerid,green,"=>Sandra<= for the 1337 property system");
	SendClientMessage(playerid,green,"Las Venturas Playground for gamemode feature influences");
	SendClientMessage(playerid,green,"Las Venturas Xtreme Development Team for the rest");
	return 1;
}

CMD:serverinfo(playerid,params[])
{
	#pragma unused params
	if(PlayerInfo[playerid][Developer] == 1 || PlayerInfo[playerid][Level] >= 2)
	{
        new TotalVehicles = CreateVehicle(411, 0, 0, 0, 0, 0, 0, 1000);    DestroyVehicle(TotalVehicles);
	    new numo = CreateDynamicObject(1245,0,0,1000,0,0,0);	DestroyObject(numo);
	    new nump = CreatePickup(371,2,0,0,1000);	DestroyPickup(nump);
	    new gz = GangZoneCreate(3,3,5,5);	GangZoneDestroy(gz);

        new Imodel[250], nummodel;
	    for(new i=1;i<TotalVehicles;i++) Imodel[GetVehicleModel(i)-400]++;
	    for(new i=0;i<250;i++) if(Imodel[i]!=0) nummodel++;

	    new string[128];
	    format(string,sizeof(string),"Server Info: [ Players Connected: %d || Maximum Players: %d ] [Ratio %0.2f ]",ConnectedPlayers(),GetMaxPlayers(),Float:ConnectedPlayers() / Float:GetMaxPlayers() );
	    SendClientMessage(playerid,green,string);
        format(string,sizeof(string),"Server Info: [ Vehicles: %d || Models %d || Players In Vehicle: %d || InCar %d / OnBike %d ]",TotalVehicles-1,nummodel, InVehCount(),InCarCount(),OnBikeCount() );
	    SendClientMessage(playerid,green,string);
	    format(string,sizeof(string),"Server Info: [ Objects: %d || Pickups %d || Gangzones %d ]",numo-1, nump, gz);
	    SendClientMessage(playerid,green,string);
	    format(string,sizeof(string),"Server Info: [ Players In Jail %d || Players Frozen %d ]",JailedPlayers(),FrozenPlayers() );
	    return SendClientMessage(playerid,green,string);
	} else return 0;
}

CMD:announce(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
	{
		new string[128], msg;
		if(sscanf(params, "s", msg)) return SendClientMessage(playerid,red,"USAGE: /announce <text>");
		{
			SendClientMessageToAll(Red,"-----------------------------------");
	    	format(string,sizeof(string),"News: %s",msg);
    		SendClientMessageToAll(DAYTONA_YELLOW,string);
    		SendClientMessageToAll(Red,"-----------------------------------");
    		SendClientMessage(playerid,MANAGEMENT,"Announcement successfully shown to players!");
		}
    } else return 0;
    return 1;
}

CMD:vr(playerid, params[])  // Usage /vr [playerid/name] health
{
	new
		string[128];

	if(PlayerInfo[playerid][Level] >= 2)
	{
		if(isnull(params))
		{
			if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, red, "Error: You are not in a vehicle.");
			RepairVehicle(GetPlayerVehicleID(playerid));
			PlayerPlaySound(playerid, 1133, 0.0, 0.0, 0.0);
			SendClientMessage(playerid, MANAGEMENT, "Vehicle Fixed");

		} else {

			new
				player1,
				Car_health;
			sscanf(params, "uD(1000)", player1, Car_health);

			if(player1 == INVALID_PLAYER_ID) return SendClientMessage(playerid, red, "Player is not connected or is yourself.");
			if(!IsPlayerInAnyVehicle(player1)) return SendClientMessage(playerid, red, "Error: Player is not in a vehicle.");

			new
				Vehicle_ID = GetPlayerVehicleID(player1);
			if(Car_health == 1000) { RepairVehicle(Vehicle_ID); } else { SetVehicleHealth(Vehicle_ID, Car_health); }

			format(string, sizeof (string), "*** %s has repaired your vehicle", pName(playerid));
			SendClientMessage(player1, MANAGEMENT, string);

			if(playerid != player1)
			{
				format(string, sizeof (string), "*** You have repaired %s's Vehicle_Model %d", pName(player1), GetVehicleModel(Vehicle_ID));
				SendClientMessage(playerid, MANAGEMENT, string);
			}
		}
	} else return 0;
	return 1;
}

CMD:jetpack(playerid,params[])
{
    new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
    if(isnull(params))
	{
    	if(PlayerInfo[playerid][Level] >= 4 || IsPlayerAdmin(playerid))
		{
			SendClientMessage(playerid,MANAGEMENT,"Jetpack Spawned.");
			return SetPlayerSpecialAction(playerid, 2);
		}
		else return 0;
	}
	else if(sscanf(params, "u", player1))
	{
		if(PlayerInfo[playerid][Level] >= 4)
		{
		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid)
	 		{
				CMDMessageToAdmins(playerid,"JETPACK");		SetPlayerSpecialAction(player1, 2);
				GetPlayerName(player1, playername, sizeof(playername));		GetPlayerName(playerid, adminname, sizeof(adminname));
				format(string,sizeof(string),"Administrator %s has given you a jetpack",adminname); SendClientMessage(player1,blue,string);
				format(string,sizeof(string),"You have given %s a jetpack", playername);
				AdminGaveMeIt[player1] = 1;
				return SendClientMessage(playerid,blue,string);
			} else return SendClientMessage(playerid, red, "Player is not connected or is yourself");
		}
		else return 0;
	}
	return 1;
}

CMD:flip(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid)) {
	    if(!strlen(params)) {
		    if(IsPlayerInAnyVehicle(playerid)) {
			new VehicleID, Float:X, Float:Y, Float:Z, Float:Angle; GetPlayerPos(playerid, X, Y, Z); VehicleID = GetPlayerVehicleID(playerid);
			GetVehicleZAngle(VehicleID, Angle);	SetVehiclePos(VehicleID, X, Y, Z); SetVehicleZAngle(VehicleID, Angle); SetVehicleHealth(VehicleID,1000.0);
			CMDMessageToAdmins(playerid,"FLIP"); return SendClientMessage(playerid, MANAGEMENT,"Vehicle Flipped. You can also do /flip [playerid]");
			} else return SendClientMessage(playerid,red,"Error: You are not in a vehicle. You can also do /flip [playerid]");
		}
	    new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
	    player1 = strval(params);

	 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) {
			CMDMessageToAdmins(playerid,"FLIP");
			if (IsPlayerInAnyVehicle(player1)) {
				new VehicleID, Float:X, Float:Y, Float:Z, Float:Angle; GetPlayerPos(player1, X, Y, Z); VehicleID = GetPlayerVehicleID(player1);
				GetVehicleZAngle(VehicleID, Angle);	SetVehiclePos(VehicleID, X, Y, Z); SetVehicleZAngle(VehicleID, Angle); SetVehicleHealth(VehicleID,1000.0);
				CMDMessageToAdmins(playerid,"FLIP");
				GetPlayerName(player1, playername, sizeof(playername));		GetPlayerName(playerid, adminname, sizeof(adminname));
				format(string,sizeof(string),"Administrator %s flipped your vehicle",adminname); SendClientMessage(player1,MANAGEMENT,string);
				format(string,sizeof(string),"You have flipped %s's vehicle", playername);
				return SendClientMessage(playerid, MANAGEMENT,string);
			} else return SendClientMessage(playerid,red,"Error: This player isn't in a vehicle");
		} else return SendClientMessage(playerid, red, "Player is not connected or is yourself");
	} else return 0;
}

CMD:dc(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 5)
	{
	    if(IsPlayerInAnyVehicle(playerid))
	    {
	        new vID = GetPlayerVehicleID(playerid);
			if(DynamicV[vID] == 1)
			{   DynamicV[vID] = 0;
				DestroyVehicle(GetPlayerVehicleID(playerid));
				SendClientMessage(playerid,White,"Vehicle was destroyed!");
			} else return SendClientMessage(playerid, Red, "You need to be in a dynamic vehicle to destroy it!");
		} else return SendClientMessage(playerid, Red, "You need to be in a vehicle to use this!");
	} else return 0;
	return 1;
}

CMD:despawn(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 3) {
		if(IsPlayerInAnyVehicle(playerid)) {
			new vehicle = GetPlayerVehicleID(playerid);
			SetVehicleToRespawn(vehicle); SendClientMessage(playerid,MANAGEMENT,"*** Vehicle successfully set for respawn!");
			return 1;
		} else return SendClientMessage(playerid,red,"Error: You need to be in a vehicle to despawn it!");
	} else return 0;
}

CMD:regupdate(playerid,params[]) {
	#pragma unused playerid, params
	if(PlayerInfo[playerid][Level] >= 5)
	{
	    RegularPlayer();
	    return 1;
	} else return 0;
}

CMD:teleplayer(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) {
	    new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	    if(!strlen(tmp) || !strlen(tmp2) || !IsNumeric(tmp) || !IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /teleplayer [playerid] to [playerid]");
		new player1 = strval(tmp), player2 = strval(tmp2), string[128], Float:plocx,Float:plocy,Float:plocz;
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
	 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
 		 	if(IsPlayerConnected(player2) && player2 != INVALID_PLAYER_ID) {
	 		 	CMDMessageToAdmins(playerid,"TELEPLAYER");
				GetPlayerPos(player2, plocx, plocy, plocz);
				new intid = GetPlayerInterior(player2);	SetPlayerInterior(player1,intid);
				SetPlayerVirtualWorld(player1,GetPlayerVirtualWorld(player2));
				if (GetPlayerState(player1) == PLAYER_STATE_DRIVER)
				{
					new VehicleID = GetPlayerVehicleID(player1);
					SetVehiclePos(VehicleID, plocx, plocy+4, plocz); LinkVehicleToInterior(VehicleID,intid);
					SetVehicleVirtualWorld(VehicleID, GetPlayerVirtualWorld(player2) );
				}
				else SetPlayerPos(player1,plocx,plocy+2, plocz);
				format(string,sizeof(string),"Administrator \"%s\" has teleported \"%s\" to \"%s's\" location", pName(playerid), pName(player1), pName(player2) );
				SendClientMessage(player1,blue,string); SendClientMessage(player2,blue,string);
				format(string,sizeof(string),"You have teleported \"%s\" to \"%s's\" location", pName(player1), pName(player2) );
 		 	    return SendClientMessage(playerid,blue,string);
 		 	} else return SendClientMessage(playerid, red, "Player2 is not connected");
		} else return SendClientMessage(playerid, red, "Player1 is not connected");
	} else return SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
}

CMD:goto(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid)) {
	    if(!strlen(params)) return SendClientMessage(playerid,red,"USAGE: /goto [playerid]");
	    new player1, string[128];
		if(!IsNumeric(params)) player1 = ReturnPlayerID(params);
	   	else player1 = strval(params);
	 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) {
			CMDMessageToAdmins(playerid,"GOTO");
			new Float:x, Float:y, Float:z;	GetPlayerPos(player1,x,y,z); SetPlayerInterior(playerid,GetPlayerInterior(player1));
			SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(player1));
			if(GetPlayerState(playerid) == 2) {
				SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z);	LinkVehicleToInterior(GetPlayerVehicleID(playerid),GetPlayerInterior(player1));
				SetVehicleVirtualWorld(GetPlayerVehicleID(playerid),GetPlayerVirtualWorld(player1));
			} else SetPlayerPos(playerid,x+2,y,z);
			format(string,sizeof(string),"You have teleported to \"%s\"", pName(player1));
			return SendClientMessage(playerid,MANAGEMENT,string);
		} else return SendClientMessage(playerid, red, "Player is not connected or is yourself");
	} return 0;
}

CMD:vgoto(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) {
	    if(!strlen(params)) return SendClientMessage(playerid,red,"USAGE: /vgoto [vehicleid]");
	    new player1, string[128];
	    player1 = strval(params);
		CMDMessageToAdmins(playerid,"VGOTO");
		new Float:x, Float:y, Float:z;	GetVehiclePos(player1,x,y,z);
		SetPlayerVirtualWorld(playerid,GetVehicleVirtualWorld(player1));
		if(GetPlayerState(playerid) == 2) {
			SetVehiclePos(GetPlayerVehicleID(playerid),x+3,y,z);
			SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), GetVehicleVirtualWorld(player1) );
		} else SetPlayerPos(playerid,x+2,y,z);
		format(string,sizeof(string),"You have teleported to vehicle id %d", player1);
		return SendClientMessage(playerid,MANAGEMENT,string);
	} return 0;
}

CMD:vget(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) {
	    if(!strlen(params)) return SendClientMessage(playerid,red,"USAGE: /vget [vehicleid]");
	    new player1, string[128];
	    player1 = strval(params);
		CMDMessageToAdmins(playerid,"VGET");
		new Float:x, Float:y, Float:z;	GetPlayerPos(playerid,x,y,z);
		SetVehiclePos(player1,x+3,y,z);
		SetVehicleVirtualWorld(player1,GetPlayerVirtualWorld(playerid));
		format(string,sizeof(string),"You have brought vehicle id %d to your location", player1);
		return SendClientMessage(playerid,MANAGEMENT,string);
	} return 0;
}

CMD:gotopos(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) {
		new Float:x, Float:y, Float:z;
        new tmp[256], tmp2[256], tmp3[256];
		new string[128], Index;	tmp = strtok(params,Index); tmp2 = strtok(params,Index); tmp3 = strtok(params,Index);
    	if(!strlen(tmp) || !strlen(tmp2) || !strlen(tmp3)) return SendClientMessage(playerid,red,"USAGE: /lgoto [x] [y] [z]");
	    x = strval(tmp);		y = strval(tmp2);		z = strval(tmp3);
		CMDMessageToAdmins(playerid,"LGOTO");
		if(GetPlayerState(playerid) == 2) SetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
		else SetPlayerPos(playerid,x,y,z);
		format(string,sizeof(string),"You have teleported to %f, %f, %f", x,y,z); return SendClientMessage(playerid,MANAGEMENT,string);
	} return 0;
}

CMD:givecar(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid)) {
	    if(!strlen(params)) return SendClientMessage(playerid,red,"USAGE: /givecar [playerid]");
	    new player1 = strval(params), playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
	    if(IsPlayerInAnyVehicle(player1)) return SendClientMessage(playerid,red,"ERROR: Player already has a vehicle");
	 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) {
			CMDMessageToAdmins(playerid,"GIVECAR");
			new Float:x, Float:y, Float:z;	GetPlayerPos(player1,x,y,z);
			CarSpawner(player1,415);
			GetPlayerName(player1, playername, sizeof(playername));		GetPlayerName(playerid, adminname, sizeof(adminname));
			format(string,sizeof(string),"*** Administrator %s has given you a car",adminname);	SendClientMessage(player1,MANAGEMENT,string);
			format(string,sizeof(string),"You have given %s a car", playername); return SendClientMessage(playerid,MANAGEMENT,string);
		} else return SendClientMessage(playerid, red, "Player is not connected or is yourself");
	} return 0;
}

CMD:get(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 3|| IsPlayerAdmin(playerid)) {
	    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /get [playerid]");
    	new player1, string[128];
		if(!IsNumeric(params)) player1 = ReturnPlayerID(params);
	   	else player1 = strval(params);
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
	 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid) {
			CMDMessageToAdmins(playerid,"GET");
			new Float:x, Float:y, Float:z;	GetPlayerPos(playerid,x,y,z); SetPlayerInterior(player1,GetPlayerInterior(playerid));
			SetPlayerVirtualWorld(player1,GetPlayerVirtualWorld(playerid));
			if(GetPlayerState(player1) == 2)	{
			    new VehicleID = GetPlayerVehicleID(player1);
				SetVehiclePos(VehicleID,x+3,y,z);   LinkVehicleToInterior(VehicleID,GetPlayerInterior(playerid));
				SetVehicleVirtualWorld(GetPlayerVehicleID(player1),GetPlayerVirtualWorld(playerid));
			} else SetPlayerPos(player1,x+2,y,z);
			format(string,sizeof(string),"You have been teleported to Administrator %s's location", pName(playerid) );	SendClientMessage(player1,MANAGEMENT,string);
			format(string,sizeof(string),"You have teleported %s to your location", pName(player1) );
			return SendClientMessage(playerid,MANAGEMENT,string);
		} else return SendClientMessage(playerid, red, "Player is not connected or is yourself");
	} return 0;
}

CMD:avfix(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][Level] >= 3) {
        ResetAdminCars();
        SendClientMessage(playerid,MAD_WHITE,"** Crew car pool reloaded!");
        new str[254];
        format(str,sizeof(str), "[ALERT] %s reloaded the Crew car pool.", PlayerName2(playerid));
        MessageToAdminsEx(playerid,MAD_WHITE,str);
        return 1;
	} else return 0;
}

CMD:warn(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 2) {
	    new tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	    if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /warn [playerid] [reason]");
    	new warned = strval(tmp), str[128];
		if(PlayerInfo[warned][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
	 	if(IsPlayerConnected(warned) && warned != INVALID_PLAYER_ID) {
 	    	if(warned != playerid) {
			    CMDMessageToAdmins(playerid,"WARN");
				PlayerInfo[warned][Warnings]++;
				if( PlayerInfo[warned][Warnings] == MAX_WARNINGS) {
					format(str, sizeof (str), "***Administrator %s has kicked %s.  (Reason: %s) (Warning: %d/%d)***", pName(playerid), pName(warned), params[1+strlen(tmp)], PlayerInfo[warned][Warnings], MAX_WARNINGS);
					SendClientMessageToAll(grey, str);
					SaveToFile("KickLog",str);	Kick(warned);
					return PlayerInfo[warned][Warnings] = 0;
				} else {
					format(str, sizeof (str), "***Administrator %s has given %s a warning.  (Reason: %s) (Warning: %d/%d)***", pName(playerid), pName(warned), params[1+strlen(tmp)], PlayerInfo[warned][Warnings], MAX_WARNINGS);
					return SendClientMessageToAll(DAYTONA_YELLOW, str);
				}
			} else return SendClientMessage(playerid, red, "ERROR: You cannot warn yourself");
		} else return SendClientMessage(playerid, red, "ERROR: Player is not connected");
	} return 0;
}

CMD:kick(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
	    if(PlayerInfo[playerid][Level] >= 2) {
		    new tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /kick [playerid] [reason]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);

		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
				GetPlayerName(player1, playername, sizeof(playername));		GetPlayerName(playerid, adminname, sizeof(adminname));
				CMDMessageToAdmins(playerid,"KICK");
				if(!strlen(tmp2)) {
					format(string,sizeof(string),"%s has been kicked by Administrator %s",playername,adminname); SendClientMessageToAll(grey,string);
					SaveToFile("KickLog",string); print(string); return Kick(player1);
				} else {
					format(string,sizeof(string),"%s has been kicked by Administrator %s: %s ",playername,adminname,params[2]); SendClientMessageToAll(grey,string);
					SaveToFile("KickLog",string); print(string);

					GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
				    new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second);

                    SendClientMessage(player1, red, "=====================");
                    format(string,sizeof(string),"You have been kicked by %s for: %s [Date: %d/%d/%d] [Time: %d:%d]",adminname,params[2],day,month,year,hour,minuite);
				    SendClientMessage(player1, red,string);
				    SendClientMessage(player1, red, "=====================");  return Kick(player1); }

			} else return SendClientMessage(playerid, red, "Player is not connected or is yourself or is the highest level admin");
		} return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

CMD:ban(playerid,params[])
{
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
		if(PlayerInfo[playerid][Level] >= 2)
		{
		    new player1, reason[64], string[128];
		    if(sscanf(params, "us[64]", player1, reason))
		    {
            	if(!IsPlayerNPC(player1))
            	{
		 			if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
		 			{
						if(player1 != playerid && PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel])
						{
							if(PlayerInfo[player1][Level] != PlayerInfo[playerid][Level] && PlayerInfo[player1][Level] < PlayerInfo[playerid][Level])
							{
								if(udb_Exists(pName(player1)) && PlayerInfo[player1][LoggedIn])
								{
								    new year,month,day,hour,minuite,second;
									getdate(year, month, day); gettime(hour,minuite,second);
									dUserSetINT(pName(player1)).("banned",1);
									SendBanMsg(player1, playerid, reason);
									format(string,sizeof(string),"%s was banned by %s for: %s [Date: %d/%d/%d] [Time: %d:%d]",pName(player1),pName(playerid),reason,day,month,year,hour,minuite);
									SendClientMessageToAllEx(player1,COLOR_ORANGE,string);
									SaveToFile("BanLog",string);
									print(string);
									Kick(player1);
								}
								else
								{
								    new year,month,day,hour,minuite,second;
									getdate(year, month, day); gettime(hour,minuite,second);
							    	format(string,sizeof(string),"%s was banned by %s for: %s [Date: %d/%d/%d] [Time: %d:%d]",pName(player1),pName(playerid),reason,day,month,year,hour,minuite);
	                                SaveToFile("BanLog",string);
									print(string);
									SendClientMessageToAllEx(player1,COLOR_ORANGE,string);
	                            	SendBanMsg(player1, playerid, reason);
									Ban(player1);
								}
							}
							else
							{
							    SendClientMessage(playerid, Red, "Tut, tut, tut! Play nice. Banning staff members is not allowed.");
							}
						}
						else
						{
						    SendClientMessage(playerid, Red, "ERROR: You cannot ban yourself or a founder.");
						}
					}
					else
					{
						SendClientMessage(playerid, Red, "Player is not connected");
					}
				}
				else
				{
				    SendClientMessage(playerid, Red, "ERROR: You cannot ban NPC's.");
				}
			}
			else
			{
			    SendClientMessage(playerid, Red, "USAGE: /ban [PlayerID/Name] [Reason]");
			}
		}
		else
		{
			return 0;
		}
	}
	else
	{
		SendClientMessage(playerid,Red,"ERROR: You must be logged in to use this commands");
	}
	return 1;
}

CMD:unban(playerid,params[])
{
    #pragma unused playerid

    if(PlayerInfo[playerid][LoggedIn])
    {
        if(PlayerInfo[playerid][Level] >= 3)
        {
            new uBan[MAX_PLAYER_NAME], string[128];
            if(sscanf(params, "s", uBan))
            {
        		if(udb_Exists(uBan))
				{
                    if(udb_UserInt(uBan, "banned") == 1)
                    {
            			new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second);
            			format(string,sizeof(string),"%s was unbanned by %s [Date: %d/%d/%d] [Time: %d:%d]",uBan,pName(playerid),day,month,year,hour,minuite);
            			SaveToFile("BanLog",string);
            			MessageToAdmins(red,string);
            			print(string);
            			dUserSetINT(uBan).("banned",0);
					}
					else
					{
					    SendClientMessage(playerid, Red, "Specified account is not banned.");
					}
				}
				else
				{
					SendClientMessage(playerid, red, "User Database does not exist. (not registered)");
				}
			}
			else
			{
			    SendClientMessage(playerid, Red, "USAGE: /unban [PlayerName]");
			}
    	}
		else
		{
	 		return 0;
		}
	}
	else
	{
		LoginMsg(playerid);
	}
	return 1;
}

LoginMsg(playerid)
{
	SendClientMessage(playerid, Red, "You need to login to use this command.");
	return 1;
}

CMD:rban(playerid,params[])
{
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
		if(PlayerInfo[playerid][Level] >= 3)
		{
		    new ip[128], tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /rban [playerid] [reason]");
			if(!strlen(tmp2)) return SendClientMessage(playerid, red, "ERROR: You must give a reason");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);

		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) )
			{
				GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
				new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second);
				CMDMessageToAdmins(playerid,"RBAN");
				format(string,sizeof(string),"%s has been range banned by Administrator %s [Reason: %s] [Date: %d/%d/%d] [Time: %d:%d]",playername,adminname,params[2],day,month,year,hour,minuite);
				SendClientMessageToAll(grey,string);
				SaveToFile("BanLog",string);
				print(string);
				if(udb_Exists(PlayerName2(player1)) && PlayerInfo[player1][LoggedIn] == 1) dUserSetINT(PlayerName2(player1)).("banned",1);
				GetPlayerIp(player1,ip,sizeof(ip));
	            strdel(ip,strlen(ip)-2,strlen(ip));
    	        format(ip,128,"%s**",ip);
				format(ip,128,"banip %s",ip);
				PlaySoundForAll(1053);
            	SendRconCommand(ip);
				return 1;
			} else return SendClientMessage(playerid, red, "Player is not connected or is yourself or is the highest level admin");
		} return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

CMD:unbanip(playerid,params[])
{
	#pragma unused playerid

	if(PlayerInfo[playerid][Level] >= 3)
	{
	    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /unban [ip]");
		new string[128]; new string2[128]; new string3[128]; new adminname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, adminname, sizeof(adminname));
		format(string,sizeof(string),"unbanip %s", params);
		format(string2,sizeof(string2),"*** You have unbanned ip %s", params);
		format(string3,sizeof(string3),"*** %s has unbanned the IP: %s",adminname, params);
        MessageToAdmins(red,string3);
		SendClientMessage(playerid,MANAGEMENT,string2);
		SendRconCommand(string);
		SendRconCommand("reloadbans");
		return 1;
	} else return 0;
}

/*
CMD:ownhacker(playerid,params[]) {
    new tmp[256], Index; tmp = strtok(params,Index);
    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /ownhacker[playerid]");
    new player1, playername[MAX_PLAYER_NAME], reporter[MAX_PLAYER_NAME];
    player1 = strval(tmp);

    if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && (PlayerInfo[player1][Level] < 2)) {
        GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, reporter, sizeof(reporter));
		new Float:Health; GetPlayerHealth(player1,Health);
        if(Health >= 100 && IsSpawning[playerid] == 0) {
			SendClientMessage(playerid,red,"Suspected Health Hacker, checking ...");
			SetPlayerHealth(player1,95);
			if(Health > 96 && IsSpawning[playerid] == 0) {
                new str[256];
                format(str,sizeof(str),"[ALERT] %s's health is above 100.0 (%s). %s initiated this command.",playername, Health, reporter);
                MessageToAdmins(red,str);
                SendClientMessage(playerid,MANAGEMENT,"*** Players health is over the normal limit. Administrators have been notified!");
                TogglePlayerControllable(player1,false); SendClientMessage(player1,red,"[ALERT] You have been found with health above the normal limit.");// SendClientMessage(player1,red,"You have been banned for Health Hacking. If you feel this an error, please make an appeal on the forums");
                //SendClientMessage(player1,red,"or talk to an Administrator direct on IRC: irc.gtanet.com Channel: #LVX"); Ban(player1);
                //new strban[254];
                //format(strban,sizeof(strban),"%s was banned for: Health Hacking!", playername);
                //SendClientMessageToAll(COLOR_ORANGE,strban);
			} else return SendClientMessage(playerid,red,"Error: Player is not currently Health Hacking"); SetPlayerHealth(player1,100.0);
		} else return SendClientMessage(playerid,red,"Error: Selected players health is not above the maximum, or the player is spawning!");
    } else return SendClientMessage(playerid,red,"Error: Player is either not connected, or is an Administrator!");
	return 1;
}
*/      // Failing command

CMD:whatskin(playerid,params[])
{
	if(PlayerInfo[playerid][Level] >= 2)
	{
        new tmp[256], Index; tmp = strtok(params,Index);
        new player1, playername[MAX_PLAYER_NAME], string[254];
        player1 = strval(tmp);

        if(!strlen(params)) player1 = playerid;

        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
		{
            GetPlayerName(player1, playername, sizeof(playername));
            new skin = GetPlayerSkin(player1);
            format(string,sizeof(string),"** %s is using skin ID %d",playername, skin); SendClientMessage(playerid,MANAGEMENT,string);
			return 1;
		} else return SendClientMessage(playerid,red,"Error: Player is not connected!");
	} else return 0;
}

CMD:handofgod(playerid,params[])
{
	if(PlayerInfo[playerid][Level] >= 2)
	{

        new tmp[256], Index; tmp = strtok(params,Index);
        if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /handofgod [playerid]");
        new player1, string[128];
        player1 = strval(tmp);
        if(NewbieSpawnDone[playerid] == 0) return SendClientMessage(playerid, Red, "* WARNING: This player is still under newbie protection!");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
			  HandOfGodHim(playerid);
			  format(string,sizeof(string),"[ADMIN]%s used the Hand of God command on %s",PlayerName2(playerid), PlayerName2(player1));
			  return MessageToAdminsEx(playerid,red,string);
        } else return SendClientMessage(playerid, red, "Player is not connected or is the highest level admin");
    } else return 0;
}

CMD:explode(playerid,params[])
{
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
		if(PlayerInfo[playerid][Level] >= 3)
		{
		    new tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /explode [playerid] [reason]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);
            if(NewbieSpawnDone[playerid] == 0) return SendClientMessage(playerid, Red, "* WARNING: This player is still under newbie protection!");
		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
				GetPlayerName(player1, playername, sizeof(playername)); 	GetPlayerName(playerid, adminname, sizeof(adminname));
				CMDMessageToAdmins(playerid,"EXPLODE");
				new Float:burnx, Float:burny, Float:burnz; GetPlayerPos(player1,burnx, burny, burnz); CreateExplosion(burnx, burny , burnz, 7,10.0);
                PlaySoundForAll(1159);
				if(strlen(tmp2))
				{
					format(string,sizeof(string),"You have been exploded by Administrator %s [reason: %s]",adminname,params[2]); SendClientMessage(player1,MANAGEMENT,string);
					format(string,sizeof(string),"You have exploded %s [reason: %s]", playername,params[2]); return SendClientMessage(playerid,MANAGEMENT,string);
				} else {
					format(string,sizeof(string),"You have been exploded by Administrator %s",adminname); SendClientMessage(player1,MANAGEMENT,string);
					format(string,sizeof(string),"You have exploded %s", playername); return SendClientMessage(playerid,MANAGEMENT,string); }
			} else return SendClientMessage(playerid, red, "Player is not connected or is the highest level admin");
		} return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

CMD:jail(playerid,params[])
{
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
		if(PlayerInfo[playerid][Level] >= 2)
		{
		    new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index), tmp3 = strtok(params,Index);
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /jail [playerid] [minutes] [reason]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);

		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)// && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
			{
				if(PlayerInfo[player1][Jailed] == 0)
				{
					GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
					new jtime = strval(tmp2);
					if(jtime == 0) jtime = 9999;

			       	CMDMessageToAdmins(playerid,"JAIL");
					PlayerInfo[player1][JailTime] = jtime*1000*60;
    			    SetTimerEx("JailPlayer",5000,0,"d",player1);
		    	    SetTimerEx("Jail1",1000,0,"d",player1);
		        	PlayerInfo[player1][Jailed] = 1;

					if(jtime == 9999)
					{
						if(!strlen(params[strlen(tmp2)+1])) format(string,sizeof(string),"Administrator %s has jailed %s ",adminname, playername);
						else format(string,sizeof(string),"Administrator %s has jailed %s [reason: %s]",adminname, playername, params[strlen(tmp)+1] );
   					} else {
						if(!strlen(tmp3)) format(string,sizeof(string),"Administrator %s has jailed %s for %d minutes",adminname, playername, jtime);
						else format(string,sizeof(string),"Administrator %s has jailed %s for %d minutes [reason: %s]",adminname, playername, jtime, params[strlen(tmp2)+strlen(tmp)+1] );
					}
	    			return SendClientMessageToAll(MANAGEMENT,string);
				} else return SendClientMessage(playerid, red, "Player is already in jail");
			} else return SendClientMessage(playerid, red, "Player is not connected or is the highest level admin");
		} return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

CMD:unjail(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
		if(PlayerInfo[playerid][Level] >= 2)
		{
		    new tmp[256], Index; tmp = strtok(params,Index);
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /jail [playerid]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);

		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)// && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) )
			{
				if(PlayerInfo[player1][Jailed] == 1)
				{
					GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
					format(string,sizeof(string),"Administrator %s has unjailed you",adminname);	SendClientMessage(player1,blue,string);
					format(string,sizeof(string),"Administrator %s has unjailed %s",adminname, playername);
					JailRelease(player1);
					return SendClientMessageToAll(MANAGEMENT,string);
				} else return SendClientMessage(playerid, red, "Player is not in jail");
			} else return SendClientMessage(playerid, red, "Player is not connected or is the highest level admin");
		} return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

CMD:jailed(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][LoggedIn] == 1) {
		if(PlayerInfo[playerid][Level] >= 2) {
	 		new bool:First2 = false, Count, adminname[MAX_PLAYER_NAME], string[128], i;
		    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Jailed]) Count++;
			if(Count == 0) return SendClientMessage(playerid,red, "No players are jailed");

		    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Jailed]) {
	    		GetPlayerName(i, adminname, sizeof(adminname));
				if(!First2) { format(string, sizeof(string), "Jailed Players: (%d)%s", i,adminname); First2 = true; }
		        else format(string,sizeof(string),"%s, (%d)%s ",string,i,adminname);
	        }
		    return SendClientMessage(playerid,COLOR_WHITE,string);
		} return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

CMD:vallowed(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][LoggedIn] == 1) {
		if(PlayerInfo[playerid][Level] >= 3) {
	 		new bool:First2 = false, Count, adminname[MAX_PLAYER_NAME], string[128], i;
		    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && Vallow[i] == 1 && PlayerInfo[i][Level] < 2) Count++;
			if(Count == 0) return SendClientMessage(playerid,red, "*** Currently, no players have access to crew vehicles.");

		    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && Vallow[i] == 1 && PlayerInfo[i][Level] < 2) {
	    		GetPlayerName(i, adminname, sizeof(adminname));
				if(!First2) { format(string, sizeof(string), "Players with access to crew vehicles: (%d)%s", i,adminname); First2 = true; }
		        else format(string,sizeof(string),"%s, (%d)%s ",string,i,adminname);
	        }
		    return SendClientMessage(playerid,COLOR_WHITE,string);
		} else return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this command");
}

CMD:paused(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][LoggedIn] == 1) {
		if(PlayerInfo[playerid][Level] >= 3) {
	 		new bool:First2 = false, Count, adminname[MAX_PLAYER_NAME], string[128], i;
		    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && afkdude[i] == 1) Count++;
			if(Count == 0) return SendClientMessage(playerid,red, "*** Currently, no players are AFK.");

		    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && afkdude[i] == 1) {
	    		GetPlayerName(i, adminname, sizeof(adminname));
				if(!First2) { format(string, sizeof(string), "Players AFK: (%d)%s", i,adminname); First2 = true; }
		        else format(string,sizeof(string),"%s, (%d)%s ",string,i,adminname);
	        }
		    return SendClientMessage(playerid,COLOR_WHITE,string);
		} else return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this command");
}

CMD:freeze(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
		if(PlayerInfo[playerid][Level] >= 2) {
		    new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index), tmp3 = strtok(params,Index);
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /freeze [playerid] [minutes] [reason]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);

		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
				if(PlayerInfo[player1][Frozen] == 0) {
					GetPlayerName(player1, playername, sizeof(playername)); GetPlayerName(playerid, adminname, sizeof(adminname));
					new ftime = strval(tmp2);
					if(ftime == 0) ftime = 9999;

			       	CMDMessageToAdmins(playerid,"FREEZE");
					TogglePlayerControllable(player1,false); PlayerInfo[player1][Frozen] = 1; PlayerPlaySound(player1,1057,0.0,0.0,0.0);
					PlayerInfo[player1][FreezeTime] = ftime*1000*60;
			        FreezeTimer[player1] = SetTimerEx("UnFreezeMe",PlayerInfo[player1][FreezeTime],0,"d",player1);

					if(ftime == 9999) {
						if(!strlen(params[strlen(tmp2)+1])) format(string,sizeof(string),"Administrator %s has frozen %s ",adminname, playername);
						else format(string,sizeof(string),"Administrator %s has frozen %s [reason: %s]",adminname, playername, params[strlen(tmp)+1] );
	   				} else {
						if(!strlen(tmp3)) format(string,sizeof(string),"Administrator %s has frozen %s for %d minutes",adminname, playername, ftime);
						else format(string,sizeof(string),"Administrator %s has frozen %s for %d minutes [reason: %s]",adminname, playername, ftime, params[strlen(tmp2)+strlen(tmp)+1] );
					}
		    		return SendClientMessageToAll(MANAGEMENT,string);
				} else return SendClientMessage(playerid, red, "Player is already frozen");
			} else return SendClientMessage(playerid, red, "Player is not connected or is the highest level admin");
		} return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

CMD:unfreeze(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
	    if(PlayerInfo[playerid][Level] >= 2|| IsPlayerAdmin(playerid)) {
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /unfreeze [playerid]");
	    	new player1, string[128];
			player1 = strval(params);

		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
		 	    if(PlayerInfo[player1][Frozen] == 1) {
			       	CMDMessageToAdmins(playerid,"UNFREEZE");
					UnFreezeMe(player1);
					format(string,sizeof(string),"Administrator %s has unfrozen you", PlayerName2(playerid) ); SendClientMessage(player1,blue,string);
					format(string,sizeof(string),"Administrator %s has unfrozen %s", PlayerName2(playerid), PlayerName2(player1));
		    		return SendClientMessageToAll(MANAGEMENT,string);
				} else return SendClientMessage(playerid, red, "Player is not frozen");
			} else return SendClientMessage(playerid, red, "Player is not connected or is the highest level admin");
		} return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

CMD:frozen(playerid,params[])
{
	#pragma unused params
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
		if(PlayerInfo[playerid][Level] >= 2)
		{
	 		new bool:First2 = false, Count, adminname[MAX_PLAYER_NAME], string[128], i;
		    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Frozen]) Count++;
			if(Count == 0) return SendClientMessage(playerid,red, "No players are frozen");

		    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Frozen])
			{
	    		GetPlayerName(i, adminname, sizeof(adminname));
				if(!First2)
				{
					format(string, sizeof(string), "Frozen Players: (%d)%s", i,adminname); First2 = true;
				}
		        else format(string,sizeof(string),"%s, (%d)%s ",string,i,adminname);
	        }
		    return SendClientMessage(playerid,COLOR_WHITE,string);
		} return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

CMD:mute(playerid,params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
		if(PlayerInfo[playerid][Level] >= 2) {
		    new tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /mute [playerid] [reason]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(tmp);

		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
		 	    if(PlayerInfo[player1][Muted] == 0) {
					GetPlayerName(player1, playername, sizeof(playername)); 	GetPlayerName(playerid, adminname, sizeof(adminname));
					CMDMessageToAdmins(playerid,"MUTE");
					PlayerPlaySound(player1,1057,0.0,0.0,0.0);  PlayerInfo[player1][Muted] = 1; PlayerInfo[player1][MuteWarnings] = 0;

					if(strlen(tmp2)) {
						format(string,sizeof(string),"You have been muted by Administrator %s [reason: %s]",adminname,params[2]); SendClientMessage(player1,MANAGEMENT,string);
						format(string,sizeof(string),"You have muted %s [reason: %s]", playername,params[2]); return SendClientMessage(playerid,MANAGEMENT,string);
					} else {
						format(string,sizeof(string),"You have been muted by Administrator %s",adminname); SendClientMessage(player1,MANAGEMENT,string);
						format(string,sizeof(string),"You have muted %s", playername); return SendClientMessage(playerid,MANAGEMENT,string); }
				} else return SendClientMessage(playerid, red, "Player is already muted");
			} else return SendClientMessage(playerid, red, "Player is not connected or is the highest level admin");
		} return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

CMD:unmute(playerid,params[])
{
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
		if(PlayerInfo[playerid][Level] >= 2)
		{
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /unmute [playerid]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(params);

		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) )
			{
		 	    if(PlayerInfo[player1][Muted] == 1)
			 	{
					GetPlayerName(player1, playername, sizeof(playername)); 	GetPlayerName(playerid, adminname, sizeof(adminname));
					CMDMessageToAdmins(playerid,"UNMUTE");
					PlayerPlaySound(player1,1057,0.0,0.0,0.0);  PlayerInfo[player1][Muted] = 0; PlayerInfo[player1][MuteWarnings] = 0;
					format(string,sizeof(string),"You have been unmuted by Administrator %s",adminname); SendClientMessage(player1,MANAGEMENT,string);
					format(string,sizeof(string),"You have unmuted %s", playername); return SendClientMessage(playerid,MANAGEMENT,string);
				} else return SendClientMessage(playerid, red, "Player is not muted");
			} else return SendClientMessage(playerid, red, "Player is not connected or is the highest level admin");
		} return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

CMD:muted(playerid,params[]) {
	#pragma unused params
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
		if(PlayerInfo[playerid][Level] >= 2)
		{
	 		new bool:First2 = false, Count, adminname[MAX_PLAYER_NAME], string[128], i;
		    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Muted]) Count++;
			if(Count == 0) return SendClientMessage(playerid,red, "No players are muted");

		    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Muted])
			{
	    		GetPlayerName(i, adminname, sizeof(adminname));
				if(!First2)
				{
					format(string, sizeof(string), "Muted Players: (%d)%s", i,adminname); First2 = true;
				}
		        else format(string,sizeof(string),"%s, (%d)%s ",string,i,adminname);
	        }
		    return SendClientMessage(playerid,COLOR_WHITE,string);
		} return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

CMD:akill(playerid,params[])
{
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
	    if(PlayerInfo[playerid][Level] >= 3|| IsPlayerAdmin(playerid))
		{
		    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /akill [playerid]");
	    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
			player1 = strval(params);

		 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
			 {
				if( (PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel] ) )
					return SendClientMessage(playerid, red, "You cannot akill the highest level admin");
				CMDMessageToAdmins(playerid,"AKILL");
				GetPlayerName(player1, playername, sizeof(playername));	GetPlayerName(playerid, adminname, sizeof(adminname));
				format(string,sizeof(string),"Administrator %s has killed you",adminname);	SendClientMessage(player1,MANAGEMENT,string);
				format(string,sizeof(string),"You have killed %s",playername); SendClientMessage(playerid,MANAGEMENT,string);
				return SetPlayerHealth(player1,0.0);
			} else return SendClientMessage(playerid, red, "Player is not connected");
		} return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");
}

CMD:weaps(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid))
	{
	    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /weaps [playerid]");
    	new player1, string[128], string2[64], WeapName[24], slot, weap, ammo, Count, x;
		player1 = strval(params);

	 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
		{
			format(string2,sizeof(string2),"[>> %s Weapons (id:%d) <<]", PlayerName2(player1), player1); SendClientMessage(playerid,blue,string2);
			for (slot = 0; slot < 14; slot++) {	GetPlayerWeaponData(player1, slot, weap, ammo); if( ammo != 0 && weap != 0) Count++; }
			if(Count < 1) return SendClientMessage(playerid,MANAGEMENT,"Player has no weapons");

			if(Count >= 1)
			{
				for (slot = 0; slot < 14; slot++)
				{
					GetPlayerWeaponData(player1, slot, weap, ammo);
					if( ammo != 0 && weap != 0)
					{
						GetWeaponName(weap, WeapName, sizeof(WeapName) );
						if(ammo == 65535 || ammo == 1) format(string,sizeof(string),"%s%s (1)",string, WeapName );
						else format(string,sizeof(string),"%s%s (%d)",string, WeapName, ammo );
						x++;
						if(x >= 5)
						{
						    SendClientMessage(playerid, blue, string);
						    x = 0;
							format(string, sizeof(string), "");
						}
						else format(string, sizeof(string), "%s,  ", string);
					}
			    }
				if(x <= 4 && x > 0)
				{
					string[strlen(string)-3] = '.';
				    SendClientMessage(playerid, blue, string);
				}
		    }
		    return 1;
		} else return SendClientMessage(playerid, red, "Player is not connected");
	} return 0;
}

CMD:aka(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 3 || IsPlayerAdmin(playerid))
	{
	    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /aka [playerid]");
    	new player1, playername[MAX_PLAYER_NAME], str[128], tmp3[50];
		player1 = strval(params);
	 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
	 	{
  		  	GetPlayerIp(player1,tmp3,50);
			GetPlayerName(player1, playername, sizeof(playername));
		    format(str,sizeof(str),"AKA: [%s id:%d] [%s] %s", playername, player1, tmp3, dini_Get("lsx/config/aka.txt",tmp3) );
	        return SendClientMessage(playerid,MANAGEMENT,str);
		} else return SendClientMessage(playerid, red, "Player is not connected or is yourself");
	} return 0;
}

CMD:screen(playerid,params[])
{
	if(PlayerInfo[playerid][Level] >= 2)
	{
	    new tmp[256], tmp2[256], Index;		tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /screen [id] [text]");
    	new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
		player1 = strval(params);

	 	if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) )
		{
			GetPlayerName(player1, playername, sizeof(playername));		GetPlayerName(playerid, adminname, sizeof(adminname));
			CMDMessageToAdmins(playerid,"SCREEN");
			format(string,sizeof(string),"Crew member %s has sent you a screen message",adminname);	SendClientMessage(player1,MANAGEMENT,string);
			format(string,sizeof(string),"You have sent %s a screen message (%s)", playername, params[2]); SendClientMessage(playerid,MANAGEMENT,string);
			return GameTextForPlayer(player1, params[2],4000,3);
		} else return SendClientMessage(playerid, red, "Player is not connected or is yourself or is the highest level admin");
	} return 0;
}

CMD:pm(playerid, params[]) {
	if(PlayerInfo[playerid][LoggedIn] == 1) {
	    new str[128], str2[128];
        new player1, message[128]; new strr[128];
		if(sscanf(params, "us",player1,message)) SendClientMessage(playerid,red,"USAGE: /slock [password]");
		else if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 && player1 != playerid)
		{
            format(str, sizeof(str),"PM from %s[%d]: %s",PlayerName2(playerid),playerid,message);
            format(str2, sizeof(str2),"PM sent to %s[%d]: %s",PlayerName2(player1),playerid,message);
            SendClientMessage(player1, DAYTONA_YELLOW, str);
            PlayerPlaySound(player1,1085,0.0,0.0,0.0);
            SendClientMessage(playerid,DAYTONA_YELLOW,str2);
	        format(strr, sizeof(strr), "Private Message: %s to %s: %s", PlayerName2(playerid), PlayerName2(player1), message);
	        for (new a = 0; a < MAX_PLAYERS; a++) if (IsPlayerConnected(a) && (PlayerInfo[a][Level] >= 3) && a != playerid)
	        SendClientMessage(a, MAD_WHITE, strr);


	        #if defined IRC_ON_PLZ
            new str3[128];
	        format(str3, sizeof(str3), "7*** PM: %s to %s: %s", PlayerName2(playerid), PlayerName2(player1), message);
	        ircSay(EchoConnection, CrewChan, str3);
	        #endif

            if(PlayerInfo[playerid][Muted] == 1 || ServerInfo[DisableChat] == 1)
	        {
		        new string[128];
 		        PlayerInfo[playerid][MuteWarnings]++;
		        if(PlayerInfo[playerid][MuteWarnings] < ServerInfo[MaxMuteWarnings]) {
			        format(string, sizeof(string),"WARNING: You are muted, if you continue to type you will be kicked (Warning: %d/%d)", PlayerInfo[playerid][MuteWarnings], ServerInfo[MaxMuteWarnings] );
			        SendClientMessage(playerid,red,string);
	            } else {
			        SendClientMessage(playerid,red,"You were warned! Now you have been kicked");
			        GetPlayerName(playerid, string, sizeof(string));
			        format(string, sizeof(string),"*** %s was kicked for exceeding mute warnings.", string);
			        SendClientMessageToAll(COLOR_ORANGE,string);
			        SaveToFile("KickLog",string); Kick(playerid);
	            }
			}
	    } else return SendClientMessage(playerid, red, "Player is not connected or is yourself!");
	} else return SendClientMessage(playerid, red, "You need to log in to use this command!");
	return 1;
}


CMD:worldmsg(playerid,params[])
{
    if(PlayerInfo[playerid][Regular] == 1)
	{
        new worldmsg[128], wMsg, colour;
        new cash = GetPlayerMoney(playerid);
		if(sscanf(params, "ds[128]", colour, wMsg)) return SendClientMessage(playerid, Red, "USAGE: /worldmsg [1-6] [message]");
		if(colour > 6 || colour < 1) return SendClientMessage(playerid,red,"Invalid gametext colour. Range: 1 - 6");
        if(PlayerInfo[playerid][Level] < 2 && cash < 500000) return SendClientMessage(playerid, red, "You need $500,000 for this command!");

		switch(colour)
		{
		    case 1:
			{
				format(worldmsg,sizeof(worldmsg),"~r~%s",wMsg);
			}
		    case 2:
		    {
		    	format(worldmsg,sizeof(worldmsg),"~g~%s",wMsg);
			}
			case 3:
			{
		    	format(worldmsg,sizeof(worldmsg),"~b~%s",wMsg);
			}
		    case 4:
		    {
		    	format(worldmsg,sizeof(worldmsg),"~w~%s",wMsg);
			}
			case 5:
			{
		    	format(worldmsg,sizeof(worldmsg),"~p~%s",wMsg);
			}
		    case 6:
			{
		    	format(worldmsg,sizeof(worldmsg),"~y~%s",wMsg);
			}
		}
		new str[128];
		format(str,sizeof(str),"[WORLDMSG] %s[%d] sent the message: %s",pName(playerid), playerid, wMsg);
		MessageToAdminsEx(playerid,COLOR_PURPLE,str);
		new pWorld = GetPlayerVirtualWorld(playerid);
		for(new i; i<MAX_PLAYERS; i++)
		{
  			if(GetPlayerVirtualWorld(i) == pWorld)
	    	{
				GameTextForPlayer(i, worldmsg, 4000, 5);
			}
		}
		if(PlayerInfo[playerid][Level] < 2)
		{
  			GivePlayerMoney(playerid,-500000);
		}
		else
		{
			GivePlayerMoney(playerid,-10000);
		}
		return 1;
	} else return SendClientMessage(playerid,red,"Error: Only regular players can use /worldmsg. Play longer and become regular.");
}

CMD:laston(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 2)
	{
    	new tmp2[256], file[128],player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], str[128];
		GetPlayerName(playerid, adminname, sizeof(adminname));

	    if(isnull(params))
		{
			format(file,sizeof(file),"/lsx/users/%s.sav",udb_encode(adminname));
			if(!fexist(file)) return SendClientMessage(playerid, red, "Error: File doesnt exist, player isnt registered");
			if(dUserINT(PlayerName2(playerid)).("LastOn")==0)
			{
				format(str, sizeof(str),"Never"); tmp2 = str;
			}
			else
			{
				tmp2 = dini_Get(file,"LastOn");
			}
			format(str, sizeof(str),"You were last on the server on %s",tmp2);
			return SendClientMessage(playerid, red, str);
		}
		else if(sscanf(params, "u", player1))
		{
	 		if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid)
		 	{
				CMDMessageToAdmins(playerid,"LASTON");
   	    		GetPlayerName(player1,playername,sizeof(playername)); format(file,sizeof(file),"/lsx/users/%s.sav",udb_encode(playername));
				if(!fexist(file)) return SendClientMessage(playerid, red, "Error: File doesnt exist, player isnt registered");
				if(dUserINT(PlayerName2(player1)).("LastOn")==0)
				{
					format(str, sizeof(str),"Never"); tmp2 = str;
				}
				else
				{
				    tmp2 = dini_Get(file,"LastOn");
				}
			}
			else
			{
				SendClientMessage(playerid, red, "Player is not connected or is yourself");
				return 1;
			}
			format(str, sizeof(str),"%s was last on the server on %s",playername,tmp2);
			return SendClientMessage(playerid, red, str);
		}
	}
	return 0;
}

CMD:stunt(playerid,params[])
{
    #pragma unused params

    if(InStadium[playerid] == 0)
	{

         new cash = GetPlayerMoney(playerid);
         if(cash < 25000)
		 {
             SendClientMessage(playerid, red, "You need $25,000 for this command!");
             return 1;
         }

         SetPlayerInterior(playerid, 14);
         SetPlayerPos(playerid, -1486.8618,1642.1460,1060.6719);

         new string[100]; format(string, sizeof(string),"%s[%s] has been teleported to the stunt area!", PlayerName2(playerid), playerid);
	   	 MessageToAdminsEx(playerid,MAD_WHITE,string);
         MessageToMods(red,string);

         InStadium[playerid] = 1;

         ResetPlayerWeapons(playerid);
         SendClientMessage(playerid, MANAGEMENT, "You paid $25,000 to enter the stunt arena!");
         SendClientMessage(playerid, MANAGEMENT, "To get back to LV type this command again");

	     GivePlayerMoney(playerid, -25000);
         return 1;

    }
	else
	{

		SendClientMessage(playerid, MANAGEMENT, "*** Welcome back to Los Santoa!");
   		InStadium[playerid] = 0;

    	if(IsPlayerInAnyVehicle(playerid))
		{
        	new vehicleid = GetPlayerVehicleID(playerid);
        	RemovePlayerFromVehicle(playerid);
        	SetVehicleToRespawn(vehicleid);
		}

		GivePlayerWeapon( playerid, 24, 150 );

    	SetPlayerInterior(playerid, 0);
    	new rand = random(sizeof(gRandomPlayerSpawns));
    	SetPlayerPos(playerid, gRandomPlayerSpawns[rand][0], gRandomPlayerSpawns[rand][1], gRandomPlayerSpawns[rand][2]); // Warp the player
		SetPlayerFacingAngle(playerid,180);
	}
	return 1;
}

CMD:kill(playerid,params[])
{
	#pragma unused params
	if(IsSuicidal[playerid] == 0)
	{
		SendClientMessage(playerid,red,"*** You're about to commit suicide, are you sure you want to die?!");

		new string[100]; format(string, sizeof(string),"%s is suicidal!", PlayerName2(playerid));
		SendClientMessageToAll(Gray,string);
		IsSuicidal[playerid] = 1;
		return 1;

	}
	else
	{
		SetPlayerHealth(playerid,0.0);
		new string[100]; format(string, sizeof(string),"%s has killed themself!", PlayerName2(playerid));
		MessageToAdminsEx(playerid,MAD_WHITE,string);
		IsSuicidal[playerid] = 0;
    }
    return 1;
}

CMD:leave(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][IsInDuel])
	    {
            SetPlayerRandomSpawn(playerid);
            SetPlayerRandomSpawn(PlayerInfo[playerid][DuelTo]);
            PlayerInfo[PlayerInfo[playerid][DuelFrom]][DuelTo] = INVALID_PLAYER_ID;
			PlayerInfo[playerid][DuelFrom] = INVALID_PLAYER_ID;
			PlayerInfo[playerid][IsInDuel] = 0;
			PlayerInfo[PlayerInfo[playerid][DuelFrom]][IsInDuel] = 0;
			SetPlayerVirtualWorld(PlayerInfo[playerid][DuelTo], 0);
			SetPlayerVirtualWorld(playerid, 0);
		}
		else return SendClientMessage(playerid, Red, "ERROR: You are not in any minigame!");
	}
	else return SendClientMessage(playerid, Red, "You need to log in to use this command!");
	return 1;
}

CMD:fcblockon(playerid,params[])
{
	#pragma unused params

	if(PlayerInfo[playerid][Level] >= 3)
	{
        if(FcProtOn == 0)
		{
	        CreateDynamicObject(972,2103.46, 2173.18, 5.90989,0,0,0);         // FC 1

	        SendClientMessage(playerid,MANAGEMENT,"FC Protection successfully created!");

	        FcProtOn = 1;

	        new string[100]; format(string, sizeof(string),"[ADMIN] %s has turned on the FC Protection!", PlayerName2(playerid), playerid);
   	        MessageToAdminsEx(playerid,red,string);
   	        return 1;
        } else return SendClientMessage(playerid,red,"Error: FC Protection is already active!");
    } else return 0;
}

CMD:fcblockoff(playerid,params[])
{
	#pragma unused params

	if(PlayerInfo[playerid][Level] >= 3)
	{
        if(FcProtOn == 1)
		{
            DestroyObject(FCgate1);          // FC 1
	        SendClientMessage(playerid,MANAGEMENT,"FC Protection successfully destroyed!");

	        FcProtOn = 0;

	        new string[100]; format(string, sizeof(string),"[ADMIN] %s has turned off the FC Protection!", PlayerName2(playerid), playerid);
   	        MessageToAdminsEx(playerid,red,string);
   	        return 1;
        } else return SendClientMessage(playerid,red,"Error: FC Protection hasn't been activated yet!");
    } else return 0;
}

CMD:fcopen(playerid,params[])
{
	#pragma unused params

	if(PlayerInfo[playerid][Level] >= 3)
	{
	    if(FcProtOn == 1 && Fcopen == 0)
		{
		    MoveObject(FCgate1,2184.82, -1781.71, 4.7, 3);
		    SendClientMessage(playerid,MANAGEMENT,"** FC gate was successfully opened");

		    Fcopen = 1;

		    new string[100]; format(string, sizeof(string),"[ADMIN] %s has opened the gate at FC!", PlayerName2(playerid), playerid);
   	        MessageToAdminsEx(playerid,red,string);
   	        return 1;
		} else return SendClientMessage(playerid,red,"Error: Either FC protection is not activated yet or the gate is already open!");
	} else return 0;
}

CMD:fcclose(playerid,params[])
{
	#pragma unused params

	if(PlayerInfo[playerid][Level] >= 3)
	{
	    if(FcProtOn == 1 && Fcopen == 1)
		{
		    MoveObject(FCgate1,2184.82, -1781.71, 7.7, 3);
		    SendClientMessage(playerid,MANAGEMENT,"** FC gate was successfully closed");

		    Fcopen = 0;

		    new string[100]; format(string, sizeof(string),"[ADMIN] %s has closed the gate at FC!", PlayerName2(playerid), playerid);
   	        MessageToAdminsEx(playerid,red,string);
   	        return 1;
		} else return SendClientMessage(playerid,red,"Error: Either FC protection is not activated yet or the gate is already closed!");
	} else return 0;
}

CMD:lock(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
		    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		    {
			    new engine, lights, alarm, doors, bonnet, boot, objective;
			    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
				if(doors == VEHICLE_PARAMS_OFF)
				{
				    SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine, lights, alarm, VEHICLE_PARAMS_ON, bonnet, doors, objective);
				    SendClientMessage(playerid, White, "The doors are now locked.");
				}
				else
				{
				    SendClientMessage(playerid, Red, "The doors of this vehicle are already locked.");
				}
			}
			else
			{
			    SendClientMessage(playerid, Red, "You need to be the driver of this vehicle to lock the doors.");
			}
		}
		else
		{
		    SendClientMessage(playerid, Red, "You need to be in a vehicle to lock it's doors!");
		}
	}
	else
	{
	    LoginMsg(playerid);
	}
	return 1;
}

CMD:unlock(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
		if(IsPlayerInAnyVehicle(playerid))
		{
		    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		    {
		        new engine, lights, alarm, doors, bonnet, boot, objective;
			    GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
				if(doors == VEHICLE_PARAMS_ON)
				{
				    SetVehicleParamsEx(GetPlayerVehicleID(playerid),engine, lights, alarm, VEHICLE_PARAMS_OFF, bonnet, boot, objective);
				    SendClientMessage(playerid, White, "The doors are now unlocked.");
				}
				else
				{
				    SendClientMessage(playerid, Red, "The doors of this vehicle are already unlocked.");
				}
			}
			else
			{
			    SendClientMessage(playerid, Red, "You need to be the driver of this vehicle to unlock the doors.");
			}
		}
		else
		{
		    SendClientMessage(playerid, Red, "You need to be in a vehicle to unlock it's doors!");
		}
	}
	else
	{
	    LoginMsg(playerid);
	}
	return 1;
}
	
CMD:duel(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
		new p2duel;
		if(sscanf(params, "u", p2duel)) return SendClientMessage(playerid, Red, "USAGE: /duel [PlayerID/Name]");
		PlayerInfo[playerid][DuelTo] = p2duel;
		PlayerInfo[p2duel][DuelFrom] = playerid;
		ShowPlayerDialog(playerid, DUEL_WEAPONS, DIALOG_STYLE_LIST, "Please choose the weapon set for this duel!", "Deagle \n Sawnoff & Uzi", "Ok", "Cancel");
		return 1;
	}
	return 1;
}

CMD:crew(playerid,params[])
{
    #pragma unused params
	new Count[2], i, string[128];
	for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
	{
		if(PlayerInfo[i][Level] > 0) Count[0]++;
		if(IsPlayerAdmin(i)) Count[1]++;
	}

    #if defined HIDE_ADMINS
	if(PlayerInfo[playerid][Level] == 0) {
		if(Count[0] >= 1) {
			format(string, sizeof(string), "There are %d Administrators online. Use /report <id> <reason> if you suspect a player of cheating", Count[0]);
			return SendClientMessage(playerid, MANAGEMENT, string);
		} else return SendClientMessage(playerid, Red, "No Administrators online");
	}
	#endif

	if( (Count[0] == 0 && Count[1] == 0) || (Count[0] == 0 && Count[1] >= 2 && PlayerInfo[playerid][Level] == 0) ) return SendClientMessage(playerid, blue, "No Administrators online");

	if(Count[0] == 1)
	{
	    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] > 2)
		{
			format(string, sizeof(string), "Admin: (%d)%s [%d]", i, PlayerName2(i), PlayerInfo[i][Level] ); SendClientMessage(playerid, DAYTONA_YELLOW, string);
		}
	}

 	if(Count[0] > 1)
	{
	    new x; format(string, sizeof(string), "Admins: ");
	    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] > 2)
		{
			format(string,sizeof(string),"%s(%d)%s [%d]",string,i,PlayerName2(i),PlayerInfo[i][Level]);
			x++;
			if(x >= 5)
			{
			    SendClientMessage(playerid, DAYTONA_YELLOW, string); format(string, sizeof(string), "Admins: "); x = 0;
			}
			else format(string, sizeof(string), "%s,  ", string);
	    }
		if(x <= 4 && x > 0)
		{
			string[strlen(string)-3] = '.';
		    SendClientMessage(playerid, DAYTONA_YELLOW, string);
		}
	}

    if(Count[0] == 1)
	{
	    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] == 2) {
			format(string, sizeof(string), "Moderator: (%d)%s [%d]", i, PlayerName2(i), PlayerInfo[i][Level] ); SendClientMessage(playerid, DAYTONA_YELLOW, string);
		}
	}

 	if(Count[0] > 1)
	{
	    new x; format(string, sizeof(string), "Moderators: ");
	    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] == 2 && PlayerInfo[playerid][Hidden] == 0)
		{
			format(string,sizeof(string),"%s(%d)%s [%d]",string,i,PlayerName2(i),PlayerInfo[i][Level]);
			x++;
			if(x >= 5)
			{
			    SendClientMessage(playerid, DAYTONA_YELLOW, string); format(string, sizeof(string), "Admins: "); x = 0;
			}
			else format(string, sizeof(string), "%s,  ", string);
	    }
		if(x <= 4 && x > 0)
		{
			string[strlen(string)-3] = '.';
		    SendClientMessage(playerid, DAYTONA_YELLOW, string);
		}
	}

	if( (Count[1] == 1) && (PlayerInfo[playerid][Level] > 2) )
	{
	    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i))
		{
			format(string, sizeof(string), "RCON Admin: (%d)%s", i, PlayerName2(i)); SendClientMessage(playerid, MANAGEMENT, string);
		}
	}
	if(Count[1] > 1) {
 		new x; format(string, sizeof(string), "RCON Admins: ");
	    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i))
		{
			format(string,sizeof(string),"%s(%d)%s",string,i,PlayerName2(i));
			x++;
			if(x >= 5)
			{
				SendClientMessage(playerid, MANAGEMENT, string); format(string, sizeof(string), "RCON Admins: "); x = 0;
			}
			else format(string, sizeof(string), "%s,  ", string);
	    }
		if(x <= 4 && x > 0)
		{
			string[strlen(string)-3] = '.';
		    SendClientMessage(playerid, MANAGEMENT, string);
		}
	}
	return 1;
}

CMD:npcs(playerid,params[])
{
    #pragma unused params
	new Count[1], i, string[128];
	for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i))
	{
		if(IsPlayerNPC(i)) Count[0]++;
	}

    #if defined HIDE_ADMINS
	if(PlayerInfo[playerid][Level] == 0) {
		if(Count[0] >= 1) {
			format(string, sizeof(string), "There are %d Administrators online. Use /report <id> <reason> if you suspect a player of cheating", Count[0]);
			return SendClientMessage(playerid, MANAGEMENT, string);
		} else return SendClientMessage(playerid, Red, "No Administrators online");
	}
	#endif

	if(Count[0] == 0) return SendClientMessage(playerid, blue, "No NPC's are currently connected to LSX");

    if(Count[0] == 1)
	{
	    for(i = 0; i < MAX_PLAYERS; i++)
		{
	 		if(IsPlayerConnected(i) && IsPlayerNPC(i))
	 		{
				format(string, sizeof(string), "1 NPC Connected: (%d)%s", i, PlayerName2(i)); SendClientMessage(playerid, White, string);
			}
		}
	}

 	if(Count[0] > 1)
	{
	    new x; format(string, sizeof(string), "NPC's connected to LSX: ");
	    for(i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerNPC(i))
		{
			format(string,sizeof(string),"%s(%d)%s",string,i,PlayerName2(i));
			x++;
			if(x >= 5)
			{
			    SendClientMessage(playerid, White, string); format(string, sizeof(string), "NPC's Connected to LSX: "); x = 0;
			}
			else format(string, sizeof(string), "%s,  ", string);
	    }
		if(x <= 4 && x > 0)
		{
			string[strlen(string)-3] = '.';
		    SendClientMessage(playerid, White, string);
		}
	}
	return 1;
}

CMD:getmyserial(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
		new string[128];
		format(string, sizeof(string), "Your serial number is %s", GetPlayerSerial(playerid));
		SendClientMessage(playerid, White, string);
	}
	return 1;
}

CMD:setvip(playerid,params[])
{
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
		if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
		{
		    new string[128], player1;
		    if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /setvip [playerid]");

			if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
			{
				if(PlayerInfo[player1][LoggedIn] == 1)
				{
                    if(playerid == player1) return SendClientMessage(playerid,red,"Error: You Cannot set yourself as a V.I.P. since you're an Administrator");
					if(PlayerInfo[player1][Level] >= 2) return SendClientMessage(playerid,red,"Error: This person is either an Administrator or a Moderator on Las Santos Xtreme!");
					if(PlayerInfo[player1][Level] == 1) return SendClientMessage(playerid,red,"Error: Player is already a V.I.P.");
			       	new year,month,day;   getdate(year, month, day); new hour,minute,second; gettime(hour,minute,second);

					format(string,sizeof(string),"*** Administrator %s has made you a V.I.P.! You now have full access to V.I.P. features! Check out /vip",pName(playerid));
					SendClientMessage(player1,MANAGEMENT,string);

					format(string,sizeof(string),"You have made %s a V.I.P. on %d/%d/%d at %d:%d:%d", pName(player1), day, month, year, hour, minute, second); SendClientMessage(playerid,MANAGEMENT,string);
					format(string,sizeof(string),"[ADMIN] %s has made %s a V.I.P. on %d/%d/%d at %d:%d:%d",pName(playerid), pName(player1), day, month, year, hour, minute, second); MessageToAdminsEx(playerid,red,string);
					SaveToFile("AdminLog",string);
					dUserSetINT(PlayerName2(player1)).("level",1);
					return 1;
				} else return SendClientMessage(playerid,red,"Error: Player must be registered and logged in!");
			} else return SendClientMessage(playerid, red, "Error: Player is not connected or is the highest level admin");
		} else return 0;
	} else return SendClientMessage(playerid,red,"Error: You must be logged in to use this command!");
}

CMD:delvip(playerid,params[])
{
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
		if(PlayerInfo[playerid][Level] >= 5 || IsPlayerAdmin(playerid))
		{
		    new string[128], player1;
            if(sscanf(params, "u", player1)) return SendClientMessage(playerid, red, "USAGE: /delvip [playerid]");

			if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
			{
				if(PlayerInfo[player1][LoggedIn] == 1)
				{
                    if(playerid == player1) return SendClientMessage(playerid,red,"Error: You Cannot set yourself as a V.I.P. since you're an Administrator");
					if(PlayerInfo[player1][Level] >= 2) return SendClientMessage(playerid,red,"Error: This person is either an Administrator or a Moderator on Las Venturas Xtreme!");
					if(PlayerInfo[player1][Level] == 0) return SendClientMessage(playerid,red,"ERROR: Player is not a V.I.P.");

			       	new year,month,day;   getdate(year, month, day); new hour,minute,second; gettime(hour,minute,second);

					format(string,sizeof(string),"*** An Administrator has revoked your V.I.P. rights! Contact Administrators using @ [text] to find out why.");
					SendClientMessage(player1,red,string);

					format(string,sizeof(string),"You have removed %s as a V.I.P. on %d/%d/%d at %d:%d:%d", pName(playerid), day, month, year, hour, minute, second); SendClientMessage(playerid,MANAGEMENT,string);
					format(string,sizeof(string),"[ADMIN] %s has removed %s as a V.I.P. on %d/%d/%d at %d:%d:%d",pName(playerid), pName(player1), day, month, year, hour, minute, second); MessageToAdminsEx(playerid,red,string);
					SaveToFile("AdminLog",string);
					dUserSetINT(PlayerName2(player1)).("level",0);
					return PlayerPlaySound(player1,1057,0.0,0.0,0.0);
				} else return SendClientMessage(playerid,red,"ERROR: Player must be registered and logged in!");
			} else return SendClientMessage(playerid, red, "Player is not connected");
		} else return 0;
	} else return SendClientMessage(playerid,red,"ERROR: You must be logged in to use this command!");
}

CMD:temp(playerid, params[])
{
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(PlayerInfo[playerid][Level] < 3) return 0;
	    new string[128], pID, sCommand[6];
	    if(sscanf(params, "us[6]", pID, sCommand))
		{
			SendClientMessage(playerid, Red, "USAGE: /temp [PlayerID/Name] [mod/admin/man]");
		}
		else if(!strcmp(sCommand, "mod"))
		{
		    if(PlayerInfo[playerid][Level] >= 3)
		    {
		        if(IsPlayerConnected(pID))
		        {
		            if(PlayerInfo[pID][Temped] == 0)
		            {
		                if(PlayerInfo[pID][Level] < 2)
		                {
		                    format(string, sizeof(string), "%s gave %s temporary Moderator permissions.", pName(playerid), pName(pID)); MessageToAdminsEx(playerid, MAD_WHITE, string);
							SendClientMessage(pID, MANAGEMENT, "* You have been given temporary moderator permissions.");
							format(string, sizeof(string), "You have given %s temporary moderator rights.", pName(pID));
							SendClientMessage(playerid, White, string);
							PlayerInfo[pID][Temped] = 1;
							PlayerInfo[pID][Level] = 2;
							return 1;
						}
						else return SendClientMessage(playerid, Red, "ERROR: Player is already at this level or above.");
					}
					else return SendClientMessage(playerid, Red, "ERROR: Player is already temped");
				}
				else return SendClientMessage(playerid, Red, "ERROR: Player is not connected.");
			}
			else return 0;
		}
		else if(!strcmp(sCommand, "admin"))
		{
		    if(PlayerInfo[playerid][Level] >= 5)
		    {
		        if(IsPlayerConnected(pID))
		        {
		            if(PlayerInfo[pID][Temped] == 0)
		            {
		                if(PlayerInfo[pID][Level] < 3)
		                {
		                    format(string, sizeof(string), "%s gave %s temporary Administrator permissions.", pName(playerid), pName(pID)); MessageToAdminsEx(playerid, MAD_WHITE, string);
							SendClientMessage(pID, MANAGEMENT, "* You have been given temporary administrator permissions.");
                            format(string, sizeof(string), "You have given %s temporary Administrator rights.", pName(pID));
							SendClientMessage(playerid, White, string);
							PlayerInfo[pID][Temped] = 1;
							PlayerInfo[pID][Level] = 3;
							return 1;
						}
						else return SendClientMessage(playerid, Red, "ERROR: Player is already at this level or above.");
					}
					else return SendClientMessage(playerid, Red, "ERROR: Player is already temped");
				}
				else return SendClientMessage(playerid, Red, "ERROR: Player is not connected.");
			}
			else return 0;
		}
		else if(!strcmp(sCommand, "man"))
		{
		    if(PlayerInfo[playerid][Level] >= 1337)
		    {
		        if(IsPlayerConnected(pID))
		        {
		            if(PlayerInfo[pID][Temped] == 0)
		            {
		                if(PlayerInfo[pID][Level] < 5)
		                {
		                    format(string, sizeof(string), "%s gave %s temporary Management permissions.", pName(playerid), pName(pID)); MessageToAdminsEx(playerid, MAD_WHITE, string);
							SendClientMessage(pID, MANAGEMENT, "* You have been given management moderator permissions.");
                            format(string, sizeof(string), "You have given %s temporary moderator rights.", pName(pID));
							SendClientMessage(playerid, White, string);
							PlayerInfo[pID][Temped] = 1;
							PlayerInfo[pID][Level] = 5;
							return 1;
						}
						else return SendClientMessage(playerid, Red, "ERROR: Player is already at this level or above.");
					}
					else return SendClientMessage(playerid, Red, "ERROR: Player is already temped");
				}
				else return SendClientMessage(playerid, Red, "ERROR: Player is not connected.");
			}
			else return 0;
		}
		else
		{
	 		SendClientMessage(playerid, Red, "Available parameters are: mod, admin, man.");
		}
	}
	else return SendClientMessage(playerid, Red, "ERROR: Please log in to use this command.");
	return 1;
}

CMD:unmod(playerid, params[])
{
	new string[128];
	if(PlayerInfo[playerid][Level] >= 2)
	{
	    if(PlayerInfo[playerid][LoggedIn] == 0) return SendClientMessage(playerid, Red, "ERROR: You need to log in first");
	    if(isnull(params))
	    {
	        PlayerInfo[playerid][Level] = 0;
			format(string, sizeof(string), "%s has dropped their staff permissions for this session.", pName(playerid)); MessageToAdminsEx(playerid, MAD_WHITE, string);
            SendClientMessage(playerid, Red, "You are no longer an Administrator for your current session.");
		}
	}
	else return 0;
	return 1;
}

CMD:giveadmin(playerid, params[])
{
	if(PlayerInfo[playerid][Level] >= 5)
	{
	    if(PlayerInfo[playerid][LoggedIn])
	    {
			new string[128], pID;
			if(sscanf(params, "u", pID)) return SendClientMessage(playerid, Red, "USAGE: /giveadmin [PlayerID/Name]");
			if(PlayerInfo[pID][LoggedIn] == 0) return SendClientMessage(playerid, Red, "ERROR: Player is not registered or not logged in");
			if(IsPlayerConnected(playerid))
			{
			    if(PlayerInfo[pID][Level] >= 3) return SendClientMessage(playerid, Red, "ERROR: This player is already an LSX Administrator!");
   			    if(pID == playerid) return SendClientMessage(playerid, Red, "ERROR: You are already Administrator.");

				format(string, sizeof(string), "* %s has given you Administrator permissions.", pName(playerid)); SendClientMessage(pID, MANAGEMENT, string);
				format(string, sizeof(string), "* You have given %s Administrator permissions.", pName(pID)); SendClientMessage(playerid, MANAGEMENT, string);

				dUserSetINT(pName(pID)).("level",(3));
				PlayerInfo[pID][Level] = 3;
			}
			else return SendClientMessage(playerid, Red, "ERROR: Player not connected.");
		}
		else return SendClientMessage(playerid, Red, "ERROR: You need to log in before using this command");
	}
	else return 0;
	return 1;
}

CMD:givemod(playerid, params[])
{
	if(PlayerInfo[playerid][Level] >= 5)
	{
	    if(PlayerInfo[playerid][LoggedIn])
	    {
			new string[128], pID;
			if(sscanf(params, "u", pID)) return SendClientMessage(playerid, Red, "USAGE: /givemod [PlayerID/Name]");
            if(PlayerInfo[pID][LoggedIn] == 0) return SendClientMessage(playerid, Red, "ERROR: Player is not registered or not logged in");
			if(IsPlayerConnected(playerid))
			{
                if(PlayerInfo[pID][Level] >= 2) return SendClientMessage(playerid, Red, "ERROR: This player is already an LSX Moderator!");
   			    if(pID == playerid) return SendClientMessage(playerid, Red, "ERROR: You are already Administrator.");

				format(string, sizeof(string), "* %s has given you Moderator permissions.", pName(playerid)); SendClientMessage(pID, MANAGEMENT, string);
				format(string, sizeof(string), "* You have given %s Moderator permissions.", pName(pID)); SendClientMessage(playerid, MANAGEMENT, string);

				dUserSetINT(pName(pID)).("level",(2));
				PlayerInfo[pID][Level] = 2;
			}
			else return SendClientMessage(playerid, Red, "ERROR: Player not connected.");
		}
		else return SendClientMessage(playerid, Red, "ERROR: You need to log in before using this command");
	}
	else return 0;
	return 1;
}

CMD:giveman(playerid, params[])
{
	if(PlayerInfo[playerid][Level] > 5)
	{
	    if(PlayerInfo[playerid][LoggedIn])
	    {
			new string[128], pID;
			if(sscanf(params, "u", pID)) return SendClientMessage(playerid, Red, "USAGE: /giveman [PlayerID/Name]");
            if(PlayerInfo[pID][LoggedIn] == 0) return SendClientMessage(playerid, Red, "ERROR: Player is not registered or not logged in");
			if(IsPlayerConnected(playerid))
			{
                if(PlayerInfo[pID][Level] >= 5) return SendClientMessage(playerid, Red, "ERROR: This player is already LSX Management!");
   			    if(pID == playerid) return SendClientMessage(playerid, Red, "ERROR: You are already Management.");

				format(string, sizeof(string), "* %s has given you Management permissions.", pName(playerid)); SendClientMessage(pID, MANAGEMENT, string);
				format(string, sizeof(string), "* You have given %s Management permissions.", pName(pID)); SendClientMessage(playerid, MANAGEMENT, string);

				dUserSetINT(pName(pID)).("level",(5));
				PlayerInfo[pID][Level] = 5;
			}
			else return SendClientMessage(playerid, Red, "ERROR: Player not connected.");
		}
		else return SendClientMessage(playerid, Red, "ERROR: You need to log in before using this command");
	}
	else return 0;
	return 1;
}

CMD:report(playerid,params[])
{
    new pID, reason[128];
	if(PlayerInfo[playerid][LoggedIn])
	{
	    if(sscanf(params, "us[128]",pID, reason)) return SendClientMessage(playerid, Red, "USAGE: /report [PlayerID/Name] [Reason]");

 		if(IsPlayerConnected(pID) && pID != INVALID_PLAYER_ID)
		{
			if(playerid == pID) return SendClientMessage(playerid,red,"ERROR: You Cannot report yourself");

			new str[128], hour,minute,second;
			gettime(hour,minute,second);
			format(str, sizeof(str), "%s(%d) reported %s(%d) Reason: %s |@%d:%d:%d|", pName(pID), pID ,pName(playerid), playerid, reason, hour,minute,second);
			MessageToAdmins(REPORTS, str);
			#if defined IRC_ON_PLZ
			ircSay(EchoConnection, CrewChan, str);
			ircSay(EchoConnection, ManChan, str);
			#endif
			format(str, sizeof(str), "Report(%d:%d:%d): %s(%d) reported %s(%d) Reason: %s", hour,minute,second, pName(pID), pID ,pName(playerid), playerid, reason);
            SaveToFile("ReportLog",str);
			for(new i = 1; i < MAX_REPORTS-1; i++) Reports[i] = Reports[i+1];
			Reports[MAX_REPORTS-1] = str;
			return SendClientMessage(playerid,DAYTONA_YELLOW, "* Your report has been sent to online administrators.");
		}
		else return SendClientMessage(playerid, red, "ERROR: Player is not connected");
	}
	else return SendClientMessage(playerid, red, "ERROR: You need to be logged in to use this command");
}

CMD:reports(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 2)
	{
        new ReportCount;
		for(new i = 1; i < MAX_REPORTS; i++)
		{
			if(strcmp( Reports[i], "<none>", true) != 0) { ReportCount++; SendClientMessage(playerid,COLOR_WHITE,Reports[i]); }
		}
		if(ReportCount == 0) SendClientMessage(playerid,COLOR_WHITE,"There have been no reports. Excellent work.");
    }
	else SendClientMessage(playerid,MAD_WHITE,"SERVER:Unknown Command");
	return 1;
}

CMD:uconfig(playerid,params[])
{
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 4)
	{
		UpdateConfig();
		return 1;
	} return 0;
}

CMD:botcheck(playerid,params[])
{
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 4)
	{
		for(new i=0; i<MAX_PLAYERS; i++) BotCheck(i);
		PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
		return 1;
	} return 0;
}

CMD:lockserver(playerid,params[])
{
	if(PlayerInfo[playerid][Level] >= 4)
	{
	    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /lockserver [password]");
    	new adminname[MAX_PLAYER_NAME], string[128];
		ServerInfo[Locked] = 1;
		strmid(ServerInfo[Password], params[0], 0, strlen(params[0]), 128);
		GetPlayerName(playerid, adminname, sizeof(adminname));
		format(string, sizeof(string), "Administrator %s has locked the server",adminname);
        #if defined IRC_ON_PLZ
        new str[128];
        format(string, sizeof(string), "3*** Administrator %s has locked the server",adminname);
        ircSay(EchoConnection, EchoChan, str);
        #endif
  		SendClientMessageToAll(red,"________________________________________");
  		SendClientMessageToAll(red," ");
		SendClientMessageToAll(red,string);
		SendClientMessageToAll(red,"________________________________________");
		for(new i = 0; i <= MAX_PLAYERS; i++) if(IsPlayerConnected(i)) { PlayerPlaySound(i,1057,0.0,0.0,0.0); PlayerInfo[i][AllowedIn] = true; }
		CMDMessageToAdmins(playerid,"LOCKSERVER");
		format(string, sizeof(string), "Administrator \"%s\" has set the server password to '%s'",adminname, ServerInfo[Password] );
		return MessageToAdminsEx(playerid,COLOR_WHITE, string);
	} return 0;
}

CMD:unlockserver(playerid,params[])
{
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 4)
	{
	    if(ServerInfo[Locked] == 1)
		{
	    	new adminname[MAX_PLAYER_NAME], string[128];
			ServerInfo[Locked] = 0;
			strmid(ServerInfo[Password], "", 0, strlen(""), 128);
			GetPlayerName(playerid, adminname, sizeof(adminname));
			format(string, sizeof(string), "Administrator \"%s\" has unlocked the server",adminname);
            #if defined IRC_ON_PLZ
            new str[128];
            format(string, sizeof(string), "3*** Administrator %s has locked the server",adminname);
            ircSay(EchoConnection, EchoChan, str);
            #endif
  			SendClientMessageToAll(green,"________________________________________");
	  		SendClientMessageToAll(green," ");
			SendClientMessageToAll(green,string);
			SendClientMessageToAll(green,"________________________________________");
			for(new i = 0; i <= MAX_PLAYERS; i++) if(IsPlayerConnected(i)) { PlayerPlaySound(i,1057,0.0,0.0,0.0); PlayerInfo[i][AllowedIn] = true; }
			return CMDMessageToAdmins(playerid,"UNLOCKSERVER");
		} else return SendClientMessage(playerid,red,"ERROR: Server is not locked");
	} return 0;
}

CMD:password(playerid,params[])
{
	if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /password [password]");
	if(ServerInfo[Locked] == 1)
	{
	    if(PlayerInfo[playerid][AllowedIn] == false)
		{
			if(!strcmp(ServerInfo[Password],params[0],true))
			{
				KillTimer( LockKickTimer[playerid] );
				PlayerInfo[playerid][AllowedIn] = true;
				new string[128];
				SendClientMessage(playerid,COLOR_WHITE,"You have successsfully entered the server password and may now spawn");
				format(string, sizeof(string), "%s has successfully entered server password",PlayerName2(playerid));
				return MessageToAdminsEx(playerid,COLOR_WHITE, string);
			} else return SendClientMessage(playerid,red,"ERROR: Incorrect server password");
		} else return SendClientMessage(playerid,red,"ERROR: You are already logged in");
	} else return SendClientMessage(playerid,red,"ERROR: Server isnt Locked");
}

//------------------------------------------------------------------------------
CMD:forbidname(playerid,params[])
{
	if(PlayerInfo[playerid][Level] >= 4)
	{
		if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /forbidname [nickname]");
		new File:BLfile, string[128];
		BLfile = fopen("lsx/config/ForbiddenNames.cfg",io_append);
		format(string,sizeof(string),"%s\r\n",params);
		fwrite(BLfile,string);
		fclose(BLfile);
		UpdateConfig();
		CMDMessageToAdmins(playerid,"FORBIDNAME");
		format(string, sizeof(string), "Administrator \"%s\" has added the name \"%s\" to the forbidden name list", pName(playerid), params );
		return MessageToAdminsEx(playerid,green,string);
	} return 0;
}

CMD:forbidword(playerid,params[])
{
	if(PlayerInfo[playerid][Level] >= 4)
	{
		if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /forbidword [word]");
		new File:BLfile, string[128];
		BLfile = fopen("lsx/config/ForbiddenWords.cfg",io_append);
		format(string,sizeof(string),"%s\r\n",params);
		fwrite(BLfile,string);
		fclose(BLfile);
		UpdateConfig();
		CMDMessageToAdmins(playerid,"FORBIDWORD");
		format(string, sizeof(string), "Administrator \"%s\" has added the word \"%s\" to the forbidden word list", pName(playerid), params );
		return MessageToAdminsEx(playerid,green,string);
	} return 0;
}

//==========================[ Spectate Commands ]===============================

CMD:spec(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid)) {
	    if(!strlen(params) || !IsNumeric(params)) return SendClientMessage(playerid, red, "USAGE: /lspec [playerid]");
		new specplayerid = strval(params);
		if(PlayerInfo[specplayerid][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(specplayerid) && specplayerid != INVALID_PLAYER_ID) {
			if(specplayerid == playerid) return SendClientMessage(playerid, red, "ERROR: You cannot spectate yourself");
			if(GetPlayerState(specplayerid) == PLAYER_STATE_SPECTATING && PlayerInfo[specplayerid][SpecID] != INVALID_PLAYER_ID) return SendClientMessage(playerid, red, "Spectate: Player spectating someone else");
			if(GetPlayerState(specplayerid) != 1 && GetPlayerState(specplayerid) != 2 && GetPlayerState(specplayerid) != 3) return SendClientMessage(playerid, red, "Spectate: Player not spawned");
			if( (PlayerInfo[specplayerid][Level] != ServerInfo[MaxAdminLevel]) || (PlayerInfo[specplayerid][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] == ServerInfo[MaxAdminLevel]) )
			{
                TogglePlayerSpectating(playerid, 1);
                PlayerInfo[playerid][SpecType] = SPECTATE_MODE_NORMAL;
				PlayerSpectatePlayer(playerid, specplayerid);
				CMDMessageToAdmins(playerid,"LSPEC");
				GetPlayerPos(playerid,Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]);
				GetPlayerFacingAngle(playerid,Pos[playerid][3]);
				return SendClientMessage(playerid,MANAGEMENT,"Now Spectating");
			} else return SendClientMessage(playerid,red,"ERROR: You cannot spectate the highest level admin");
		} else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:specvehicle(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid)) {
	    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /lspecvehicle [vehicleid]");
		new specvehicleid = strval(params);
		if(specvehicleid < MAX_VEHICLES) {
			TogglePlayerSpectating(playerid, 1);
			PlayerSpectateVehicle(playerid, specvehicleid);
			PlayerInfo[playerid][SpecID] = specvehicleid;
			PlayerInfo[playerid][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
			CMDMessageToAdmins(playerid,"SPEC VEHICLE");
			GetPlayerPos(playerid,Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]);
			GetPlayerFacingAngle(playerid,Pos[playerid][3]);
			return SendClientMessage(playerid,MANAGEMENT,"Now Spectating");
		} else return SendClientMessage(playerid,red, "ERROR: Invalid Vehicle ID");
	} return 0;
}

CMD:specoff(playerid,params[])
{
	#pragma unused params
    if(PlayerInfo[playerid][Level] >= 2 || IsPlayerAdmin(playerid))
	{
        if(PlayerInfo[playerid][SpecType] != ADMIN_SPEC_TYPE_NONE)
		{
			TogglePlayerSpectating(playerid, 0);
			SetTimerEx("PosAfterSpec",1000,0,"d",playerid);
			return SendClientMessage(playerid,MANAGEMENT,"No Longer Spectating");
		} else return SendClientMessage(playerid,red,"ERROR: You are not spectating");
	} return 0;
}

//==========================[ CHAT COMMANDS ]===================================

CMD:disablechat(playerid,params[])
{
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 3)
	{
		CMDMessageToAdmins(playerid,"DISABLECHAT");
		new string[128];
		#if defined IRC_ON_PLZ
	    new str2[254]; new str3[254];
	    #endif
		if(ServerInfo[DisableChat] == 0)
		{
			ServerInfo[DisableChat] = 1;
			format(string,sizeof(string),"Administrator \"%s\" has disabled chat", pName(playerid) );
			#if defined IRC_ON_PLZ
			format(str2,sizeof(str2),"3Administrator %s has muted chat", pName(playerid) );
			ircSay(EchoConnection, EchoChan, str2);
			format(str3,sizeof(str3),"MODE %s +m", EchoChan);
			#endif
		} else {
			ServerInfo[DisableChat] = 0;
			format(string,sizeof(string),"Administrator \"%s\" has enabled chat", pName(playerid) );
			#if defined IRC_ON_PLZ
			format(str2,sizeof(str2),"3Administrator %s has unmuted chat", pName(playerid) );
			ircSay(EchoConnection, EchoChan, str2);
			format(str3,sizeof(str3),"MODE %s -m", EchoChan);
			#endif
		} return SendClientMessageToAll(MANAGEMENT,string);
 	} return 0;
}

CMD:clearchat(playerid,params[]) {
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 3) {
		CMDMessageToAdmins(playerid,"CLEARCHAT");
		for(new i = 0; i < 11; i++) SendClientMessage(playerid, green," "); return 1;
 	} return 0;
}

CMD:clearallchat(playerid,params[]) {
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 3) {
		CMDMessageToAdmins(playerid,"CLEARALLCHAT");
		for(new i = 0; i < 50; i++) SendClientMessageToAll(green," "); return 1;
 	} else return 0;
}

CMD:caps(playerid,params[]) {
    if(PlayerInfo[playerid][Level] >= 3) {
	    new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	    if(!strlen(tmp) || !strlen(tmp2) || IsNumeric(tmp2)) return SendClientMessage(playerid, red, "USAGE: /caps [playerid] [\"on\" / \"off\"]");
		new player1 = strval(tmp), string[128];
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID) {
			if(strcmp(tmp2,"on",true) == 0)	{
				CMDMessageToAdmins(playerid,"CAPS");
				PlayerInfo[player1][Caps] = 0;
				if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has allowed you to use capitals in chat", pName(playerid) ); SendClientMessage(playerid,MANAGEMENT,string); }
				format(string,sizeof(string),"You have allowed \"%s\" to use capitals in chat", pName(player1) ); return SendClientMessage(playerid,MANAGEMENT,string);
			} else if(strcmp(tmp2,"off",true) == 0)	{
				CMDMessageToAdmins(playerid,"CAPS");
				PlayerInfo[player1][Caps] = 1;
				if(player1 != playerid) { format(string,sizeof(string),"Administrator \"%s\" has prevented you from using capitals in chat", pName(playerid) ); SendClientMessage(playerid,MANAGEMENT,string); }
				format(string,sizeof(string),"You have prevented \"%s\" from using capitals in chat", pName(player1) ); return SendClientMessage(playerid,MANAGEMENT,string);
			} else return SendClientMessage(playerid, red, "USAGE: /caps [playerid] [\"on\" / \"off\"]");
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

//===================[ Fake ]===================================================

CMD:fakedeath(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 3)
	{
	    new tmp[256], tmp2[256], tmp3[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index), tmp3 = strtok(params,Index);
	    if(!strlen(tmp) || !strlen(tmp2) || !strlen(tmp3)) return SendClientMessage(playerid, red, "USAGE: /fakedeath [killer] [killee] [weapon]");
		new killer = strval(tmp), killee = strval(tmp2), weap = strval(tmp3);
		//if(!IsValidWeapon(weap)) return SendClientMessage(playerid,red,"ERROR: Invalid Weapon ID");
		if(PlayerInfo[killer][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
		if(PlayerInfo[killee][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");

        if(IsPlayerConnected(killer) && killer != INVALID_PLAYER_ID)
		{
	        if(IsPlayerConnected(killee) && killee != INVALID_PLAYER_ID)
			{
	    	  	CMDMessageToAdmins(playerid,"FAKEDEATH");
				SendDeathMessage(killer,killee,weap);
				return SendClientMessage(playerid,MANAGEMENT,"Fake death message sent");
		    } else return SendClientMessage(playerid,red,"ERROR: Killee is not connected");
	    } else return SendClientMessage(playerid,red,"ERROR: Killer is not connected");
	} return 0;
}

CMD:fakechat(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 3)
	{
	    new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	    if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /fakechat [playerid] [text]");
		new player1 = strval(tmp);
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
		{
	        CMDMessageToAdmins(playerid,"FAKECHAT");
			SendPlayerMessageToAll(player1, params[strlen(tmp)+1]);
			return SendClientMessage(playerid,MANAGEMENT,"Fake message sent");
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

CMD:fakecmd(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 5)
	{
	    new tmp[256], tmp2[256], Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	    if(!strlen(tmp) || !strlen(tmp2)) return SendClientMessage(playerid, red, "USAGE: /fakecmd [playerid] [command]");
		new player1 = strval(tmp);
		if(PlayerInfo[player1][Level] == ServerInfo[MaxAdminLevel] && PlayerInfo[playerid][Level] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,red,"ERROR: You cannot use this command on this admin");
        if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID)
	 	{
	        CMDMessageToAdmins(playerid,"FAKECMD");
	        CallRemoteFunction("OnPlayerCommandReceived", "is", player1, tmp2);
			return SendClientMessage(playerid,MANAGEMENT,"Fake command sent");
	    } else return SendClientMessage(playerid,red,"ERROR: Player is not connected");
	} return 0;
}

//-------------------------- Animations --------------------------------//

CMD:stopanim(playerid,params[])
{
	#pragma unused params

	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
		ClearAnimations(playerid);
	} else return SendClientMessage(playerid,red,"Error: You need to log in to use this command!");
    return 1;
}

CMD:roll(playerid,params[])
{
	#pragma unused params

	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
        ApplyAnimation(playerid,"DAM_JUMP","Jump_Roll",4.1,0,1,1,1,1);
	} else return SendClientMessage(playerid,red,"Error: You need to log in to use this command!");
    return 1;
}

CMD:wounded(playerid,params[])
{
	#pragma unused params

	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
        ApplyAnimation(playerid,"SWAT","gnstwall_injurd",4.1,0,1,1,1,0);
	} else return SendClientMessage(playerid,red,"Error: You need to log in to use this command!");
    return 1;
}

CMD:jumphax(playerid,params[])
{
	#pragma unused params

	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
        ApplyAnimation(playerid,"SWAT","swt_vent_02",4.1,0,1,1,1,1);
	} else return SendClientMessage(playerid,red,"Error: You need to log in to use this command!");
    return 1;
}

CMD:tactical(playerid,params[])
{
	#pragma unused params

	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
        ApplyAnimation(playerid,"SWAT","swt_breach_01",4.1,0,1,1,1,1);
	} else return SendClientMessage(playerid,red,"Error: You need to log in to use this command!");
    return 1;
}

CMD:aim(playerid,params[])
{
	#pragma unused params

	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
        ApplyAnimation(playerid,"PED","ARRESTgun",4.1,0,1,1,1,1);
	} else return SendClientMessage(playerid,red,"Error: You need to log in to use this command!");
    return 1;
}

CMD:knockdown(playerid,params[])
{
	#pragma unused params

	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
        ApplyAnimation(playerid,"PED","BIKE_fallR",4.1,0,1,1,1,1);
	} else return SendClientMessage(playerid,red,"Error: You need to log in to use this command!");
    return 1;
}

CMD:piss(playerid,params[])
{
	#pragma unused params

	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
        ApplyAnimation(playerid,"PAULNMAC","Piss_in",4.1,0,1,1,0,0);
	} else return SendClientMessage(playerid,red,"Error: You need to log in to use this command!");
    return 1;
}

CMD:wave(playerid,params[])
{
	#pragma unused params

	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
        ApplyAnimation(playerid,"ON_LOOKERS","wave_loop",4.0,1,0,0,0,0);
	} else return SendClientMessage(playerid,red,"Error: You need to log in to use this command!");
	return 1;
}
//----------------------------- End of Animations -------------------------//

CMD:getall(playerid,params[]) {
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 4) {
		CMDMessageToAdmins(playerid,"GETAll");
		new Float:x,Float:y,Float:z, interior = GetPlayerInterior(playerid);
    	GetPlayerPos(playerid,x,y,z);
	   	for(new i = 0; i < MAX_PLAYERS; i++) {
			if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
				PlayerPlaySound(i,1057,0.0,0.0,0.0); SetPlayerPos(i,x+(playerid/4)+1,y+(playerid/4),z); SetPlayerInterior(i,interior);
			}
		}
		new string[128]; format(string,sizeof(string),"Administrator \"%s\" has teleported all players", pName(playerid) );
		return SendClientMessageToAll(MANAGEMENT, string);
	} return 0;
}

CMD:healall(playerid,params[]) {
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 3) {
		CMDMessageToAdmins(playerid,"HEALALL");
	   	for(new i = 0; i < MAX_PLAYERS; i++) {
			if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
				PlayerPlaySound(i,1057,0.0,0.0,0.0); SetPlayerHealth(i,100.0);
			}
		}
		new string[128]; format(string,sizeof(string),"Administrator \"%s\" has healed all players", pName(playerid) );
		return SendClientMessageToAll(MANAGEMENT, string);
	} return 0;
}

CMD:armourall(playerid,params[]) {
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 3) {
		CMDMessageToAdmins(playerid,"ARMOURALL");
	   	for(new i = 0; i < MAX_PLAYERS; i++) {
			if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
				PlayerPlaySound(i,1057,0.0,0.0,0.0); SetPlayerArmour(i,100.0);
			}
		}
		new string[128]; format(string,sizeof(string),"Administrator \"%s\" has restored all players armour", pName(playerid) );
		return SendClientMessageToAll(MANAGEMENT, string);
	} return 0;
}

CMD:killall(playerid,params[])
{
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 4)
	{
		CMDMessageToAdmins(playerid,"KILLALL");
	   	for(new i = 0; i < MAX_PLAYERS; i++)
  		{
			if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel])
			{
				PlayerPlaySound(i,1057,0.0,0.0,0.0); SetPlayerHealth(i,0.0);
			}
		}
		new string[128]; format(string,sizeof(string),"Administrator \"%s\" has killed all players", pName(playerid) );
		return SendClientMessageToAll(MANAGEMENT, string);
	} return 0;
}

CMD:freezeall(playerid,params[])
{
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 4)
	{
		CMDMessageToAdmins(playerid,"FREEZEALL");
	   	for(new i = 0; i < MAX_PLAYERS; i++)
 		{
			if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
				PlayerPlaySound(i,1057,0.0,0.0,0.0); TogglePlayerControllable(playerid,false); PlayerInfo[i][Frozen] = 1;
			}
		}
		new string[128]; format(string,sizeof(string),"Administrator \"%s\" has frozen all players", pName(playerid) );
		return SendClientMessageToAll(MANAGEMENT, string);
	} return 0;
}

CMD:unfreezeall(playerid,params[])
{
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 4)
	{
		CMDMessageToAdmins(playerid,"UNFREEZEALL");
	   	for(new i = 0; i < MAX_PLAYERS; i++)
  		{
			if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel]) {
				PlayerPlaySound(i,1057,0.0,0.0,0.0); TogglePlayerControllable(playerid,true); PlayerInfo[i][Frozen] = 0;
			}
		}
		new string[128]; format(string,sizeof(string),"Administrator \"%s\" has unfrozen all players", pName(playerid) );
		return SendClientMessageToAll(MANAGEMENT, string);
	} return 0;
}

CMD:kickall(playerid,params[])
{
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 4)
	{
		CMDMessageToAdmins(playerid,"KICKALL");
	   	for(new i = 0; i < MAX_PLAYERS; i++)
  		{
			if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel])
			{
				PlayerPlaySound(i,1057,0.0,0.0,0.0); Kick(i);
			}
		}
		new string[128]; format(string,sizeof(string),"Administrator \"%s\" has kicked all players", pName(playerid) );
		SaveToFile("KickLog",string);
		return SendClientMessageToAll(MANAGEMENT, string);
	} return 0;
}

CMD:explodeall(playerid,params[])
{
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 4)
	{
		CMDMessageToAdmins(playerid,"EXPLODEALL");
		new Float:x, Float:y, Float:z;
	   	for(new i = 0; i < MAX_PLAYERS; i++)
  		{
			if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel])
			{
				PlayerPlaySound(i,1190,0.0,0.0,0.0); GetPlayerPos(i,x,y,z);	CreateExplosion(x, y , z, 7, 10.0);
			}
		}
		new string[128]; format(string,sizeof(string),"Administrator \"%s\" has exploded all players", pName(playerid) );
		return SendClientMessageToAll(MANAGEMENT, string);
	} return 0;
}

CMD:disarmall(playerid,params[])
{
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 4)
	{
		CMDMessageToAdmins(playerid,"DISARMALL");
	   	for(new i = 0; i < MAX_PLAYERS; i++)
   		{
			if(IsPlayerConnected(i) && (i != playerid) && i != ServerInfo[MaxAdminLevel])
			{
				PlayerPlaySound(i,1057,0.0,0.0,0.0); ResetPlayerWeapons(i);
			}
		}
		new string[128]; format(string,sizeof(string),"Administrator \"%s\" has disarmed all players", pName(playerid) );
		return SendClientMessageToAll(MANAGEMENT, string);
	} return 0;
}

//-------------==== Set All Commands ====-------------//

CMD:setallskin(playerid,params[])
{
	if(PlayerInfo[playerid][Level] >= 3)
	{
	    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /setallskin [skinid]");
		new var = strval(params), string[128];
		if(!IsValidSkin(var)) return SendClientMessage(playerid, red, "ERROR: Invaild Skin ID");
       	CMDMessageToAdmins(playerid,"SETALLSKIN");
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				PlayerPlaySound(i,1057,0.0,0.0,0.0);
				SetPlayerSkin(i,var);
			}
		}
		format(string,sizeof(string),"Administrator \"%s\" has set all players skin to '%d'", pName(playerid), var );
		return SendClientMessageToAll(MANAGEMENT, string);
	} return 0;
}

CMD:giveallcash(playerid,params[])
{
	if(PlayerInfo[playerid][Level] >= 3)
	{
	    if(!strlen(params)) return SendClientMessage(playerid, red, "USAGE: /giveallcash [Amount]");
		new var = strval(params), string[128];
       	CMDMessageToAdmins(playerid,"GIVEALLCASH");
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				PlayerPlaySound(i,1057,0.0,0.0,0.0);
				GivePlayerMoney(i,var);
			}
		}
		format(string,sizeof(string),"Administrator \"%s\" has given all players '$%d'", pName(playerid), var );
		return SendClientMessageToAll(MANAGEMENT, string);
	} return 0;
}

CMD:giveallweapon(playerid,params[]) {
	if(PlayerInfo[playerid][Level] >= 3) {
	    new tmp[256], tmp2[256], Index, ammo, weap, WeapName[32], string[128]; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
	    if(!strlen(tmp) ) return SendClientMessage(playerid, red, "USAGE: /giveallweapon [weapon id/weapon name] [ammo]");
		if(!strlen(tmp2) || !IsNumeric(tmp2) || strval(tmp2) <= 0 || strval(tmp2) > 99999) ammo = 500;
		if(!IsNumeric(tmp)) weap = GetWeaponIDFromName(tmp); else weap = strval(tmp);
	  	if(!IsValidWeapon(weap)) return SendClientMessage(playerid,red,"ERROR: Invalid weapon ID");
      	CMDMessageToAdmins(playerid,"GIVEALLWEAPON");
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				PlayerPlaySound(i,1057,0.0,0.0,0.0);
				GivePlayerWeapon(i,weap,ammo);
			}
		}
		GetWeaponName(weap, WeapName, sizeof(WeapName) );
		format(string,sizeof(string),"Administrator \"%s\" has given all players a %s (%d) with %d rounds of ammo", pName(playerid), WeapName, weap, ammo);
		return SendClientMessageToAll(MANAGEMENT, string);
	} return 0;
}


//================================[ Menu Commands ]=============================

#if defined USE_MENUS

CMD:xmenu(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 3) {
        if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,red,"ERROR: You already have a car.");
        else { ShowMenuForPlayer(LMainMenu,playerid); return TogglePlayerControllable(playerid,false);  }
    } return 0;
}
CMD:tele(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 2) {
        if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,red,"ERROR: You already have a car.");
        else { ShowMenuForPlayer(LTele,playerid); return TogglePlayerControllable(playerid,false);  }
    } return 0;
}
CMD:xweather(playerid,params[]) {
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 3) {
        if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,red,"ERROR: You already have a car.");
        else { ShowMenuForPlayer(LWeather,playerid); return TogglePlayerControllable(playerid,false);  }
    } return 0;
}
CMD:xtime(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 3)
	{
        if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,red,"ERROR: You already have a car.");
        else
		{
			ShowMenuForPlayer(LTime,playerid); return TogglePlayerControllable(playerid,false);
		}
    } return 0;
}
CMD:cm(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 2)
	{
        if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,red,"ERROR: You already have a car.");
        else
		{
			ShowMenuForPlayer(LCars,playerid); return TogglePlayerControllable(playerid,false);
		}
    } return 0;
}
CMD:xtmenu(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 2)
	{
        if(IsPlayerInAnyVehicle(playerid))
		{
			new LVehicleID = GetPlayerVehicleID(playerid), LModel = GetVehicleModel(LVehicleID);
        	switch(LModel) { case 448,461,462,463,468,471,509,510,521,522,523,581,586,449: return SendClientMessage(playerid,red,"ERROR: You can not tune this vehicle!"); }
        	TogglePlayerControllable(playerid,false); return ShowMenuForPlayer(LTuneMenu,playerid);
        }
		else return SendClientMessage(playerid,red,"ERROR: You do not have a vehicle to tune");
    } return 0;
}
CMD:xweapons(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 3)
	{
        if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,red,"ERROR: You already have a car.");
        else
		{
			ShowMenuForPlayer(XWeapons,playerid); return TogglePlayerControllable(playerid,false);
		}
    } return 0;
}
CMD:xvehicle(playerid,params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 2)
	{
 		if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,red,"ERROR: You already have a car.");
        else { ShowMenuForPlayer(LVehicles,playerid); return TogglePlayerControllable(playerid,false);  }
    } return 0;
}

#endif

//----------------------===== Place & Skin Saving =====-------------------------
CMD:gotoplace(playerid,params[])
{
    #pragma unused params
	if(PlayerInfo[playerid][LoggedIn] == 1 && PlayerInfo[playerid][Level] >= 2)
	{
	    if (dUserINT(PlayerName2(playerid)).("x")!=0)
		{
		    PutAtPos(playerid);
			SetPlayerVirtualWorld(playerid, (dUserINT(PlayerName2(playerid)).("world")) );
			return SendClientMessage(playerid,yellow,"You have successfully teleported to your saved place");
		} else return SendClientMessage(playerid,red,"ERROR: You must save a place before you can teleport to it");
	} return 0;
}

CMD:saveplace(playerid,params[])
{
    #pragma unused params
	if(PlayerInfo[playerid][LoggedIn] == 1 && PlayerInfo[playerid][Level] >= 2)
	{
		new Float:x,Float:y,Float:z, interior;
		GetPlayerPos(playerid,x,y,z);	interior = GetPlayerInterior(playerid);
		dUserSetINT(PlayerName2(playerid)).("x",floatround(x));
		dUserSetINT(PlayerName2(playerid)).("y",floatround(y));
		dUserSetINT(PlayerName2(playerid)).("z",floatround(z));
		dUserSetINT(PlayerName2(playerid)).("interior",interior);
		dUserSetINT(PlayerName2(playerid)).("world", (GetPlayerVirtualWorld(playerid)) );
		return SendClientMessage(playerid,yellow,"You have successfully saved these coordinates");
	} return 0;
}
//====================== [REGISTER  &  LOGIN] ==================================
CMD:register(playerid,params[])
{
    if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,red,"PlayLSX: You are already registered and logged in.");
    if (udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,red,"PlayLSX: This account already exists, please use '/login [password]'.");
    if (strlen(params) == 0) return SendClientMessage(playerid,red,"PlayLSX: Correct usage: '/register [password]'");
    if (strlen(params) < 5 || strlen(params) > 20) return SendClientMessage(playerid,red,"ACCOUNT: Password length must be greater than four characters");
    if (udb_Create(PlayerName2(playerid),params))
	{
    	new file[256], RegCount[128], name[MAX_PLAYER_NAME], tmp3[100];
    	new strdate[20], CountDB[10], year,month,day;	getdate(year, month, day);

		GetPlayerName(playerid,name,sizeof(name));
		GetPlayerIp(playerid,tmp3,100);	dini_Set(file,"ip",tmp3);
		
		format(file,sizeof(file),"/lsx/users/%s.sav",udb_encode(name));
		format(RegCount,sizeof(RegCount),"/lsx/RegCount.ini");
   		format(strdate, sizeof(strdate), "%d/%d/%d",day,month,year);
   		format(CountDB, sizeof(CountDB),dini_Get(RegCount,"DbCount"));
   		
		dini_Set(file,"RegisteredDate",strdate);
		dini_Set(file,"HWID", GetPlayerSerial(playerid));
		dini_IntSet(file, "CustomMsg", -1);
		dini_IntSet(RegCount,"DbCount",strval(CountDB)+1);
		
		//Send a registered message to various places.
		new RegString[128];
		format(RegString, sizeof(RegString), "%s[%d] has registered an account. Total accounts to date: %s", pName(playerid), playerid, dini_Get(RegCount,"DbCount"));

		print(RegString);
		#if IRC_ENABLED == 1
		AddEcho(RegString);
		#endif
		
		dUserSetINT(PlayerName2(playerid)).("registered",1);
		dUserSetINT(PlayerName2(playerid)).("loggedin",1);
		dUserSetINT(PlayerName2(playerid)).("banned",0);
		dUserSetINT(PlayerName2(playerid)).("level",0);
		dUserSetINT(PlayerName2(playerid)).("Regular",0);
		dUserSetINT(PlayerName2(playerid)).("Developer",0);
		dUserSetINT(PlayerName2(playerid)).("Bank",0);
		dUserSetINT(PlayerName2(playerid)).("Cookies",1);
		dUserSetINT(PlayerName2(playerid)).("FavSkin",-1);
	    dUserSetINT(PlayerName2(playerid)).("LastOn",0);
    	dUserSetINT(PlayerName2(playerid)).("money",0);
    	dUserSetINT(PlayerName2(playerid)).("kills",0);
	   	dUserSetINT(PlayerName2(playerid)).("deaths",0);
	   	dUserSetINT(PlayerName2(playerid)).("hours",0);
	   	dUserSetINT(PlayerName2(playerid)).("TeleMsg",0);
	   	dUserSetINT(PlayerName2(playerid)).("MyTime",0);
	   	dUserSetINT(PlayerName2(playerid)).("MyHour",-1);
	   	dUserSetINT(PlayerName2(playerid)).("minutes",0);
	   	dUserSetINT(PlayerName2(playerid)).("seconds",0);
        dUserSetINT(PlayerName2(playerid)).("SpawnColour",255);
        dUserSetINT(PlayerName2(playerid)).("HoldingObject",255);
        dUserSetINT(PlayerName2(playerid)).("ObjectStatus",0);
        dUserSetINT(PlayerName2(playerid)).("AutoFix",0);
	   	dUserSetINT(PlayerName2(playerid)).("xAccount",0);
		dUserSetINT(PlayerName2(playerid)).("CarKey",0);
		dUserSetINT(PlayerName2(playerid)).("Licence",1);
	    LoginPlayer(playerid);
	    SendClientMessage(playerid, MANAGEMENT, "PlayLSX: You are now registered, and have been automaticaly logged in.");
	    format(RegString, sizeof(RegString), "We currently have %s players registered in our database, including you.", dini_Get(RegCount,"DbCount"));
		SendClientMessage(playerid, MANAGEMENT, RegString);
		return 1;
	}
    return 1;
}


CMD:login(playerid,params[])
{
    if(PlayerInfo[playerid][LoggedIn] == 0)
	{
	    if(isnull(params))
	    {
	        ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_INPUT,"Login to your account", "Please enter the password to your account into\n the box below and press enter.", "Login", "Cancel");
		}
		else
		{
		    SendClientMessage(playerid, Red, "INFO: This command uses no parameters. USAGE: /login");
		}
	}
	else
	{
	    SendClientMessage(playerid, Red, "ERROR: you're already logged in.");
	}
	return 1;
}



CMD:stafflogin(playerid, params[])
{
	if(PlayerInfo[playerid][Registered]) return 0;
	if(PlayerInfo[playerid][LoggedIn]) return 0;
	new string[128], pAcc[MAX_PLAYER_NAME], parse[32];
	if(sscanf(params, "s[24]s[32]", pAcc, parse)) return SendClientMessage(playerid, Red, "USAGE: /stafflogin [Account] [Password]");
	else
	{
	    if(!udb_Exists(pAcc)) return SendClientMessage(playerid, Red, "That account does not exist!");
	    if(udb_CheckLogin(pAcc,parse))
		{
			ModLogin(playerid, pAcc);
			SpawnPlayer(playerid);
			format(string, sizeof(string), "[NOTICE] %s[%d] is now logged in as %s",pName(playerid), playerid, pAcc);
			MessageToAdminsEx(playerid, COLOR_ORANGE, string);
			format(string, sizeof(string), "- System Message: You are now logged in as %s -",pAcc);
			SendClientMessage(playerid, MAD_WHITE, string);
			return 1;
		}
        else
		{
			PlayerInfo[playerid][FailLogin]++;
			format(string, sizeof(string), "[WARNING] %s[%d] has attempted to use the staff login with wrong credentials. Account: %s Attempt: %d",pName(playerid), playerid, pAcc, PlayerInfo[playerid][FailLogin]);
            print(string);
			MessageToAdmins(Red, string);
			if(PlayerInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
			{
				format(string, sizeof(string), "%s has been kicked (Code Red)", PlayerName2(playerid) );
				SendClientMessageToAll(grey, string);
				#if IRC_ENABLED == 1
				IRC_GroupSay(gGroupID, CREW_CHAN, string);
		    	AddEcho(string);
		    	#endif
				print(string);
				SendFormattedKick(playerid, "Code Red");
			}
			return SendClientMessage(playerid,red,"PlayLSX: Login failed! Incorrect Password");
		}
	}
}

CMD:me(playerid,params[])
{
    new str[128], msg;
    if(sscanf(params, "s[128]", msg)) return SendClientMessage(playerid,Red,"Use: /me [text]");
	{
    	format(str,sizeof(str),"* %s %s", pName(playerid), msg);
    	SendClientMessageToAll(GetPlayerColor(playerid), str);
		SetPlayerChatBubble(playerid, str, GetPlayerColor(playerid), 40.0, 10000);
	}
    return 1;
}

CMD:changepass(playerid,params[])
{
	if(PlayerInfo[playerid][LoggedIn] == 1)
	{
	    new string[128], pass[24];
	    if(sscanf(params, "s[24]", pass)) return SendClientMessage(playerid, Red, "USAGE: /changepass [new password]");
		if(strlen(pass) < 4 || strlen(pass) > 24) return SendClientMessage(playerid,red,"ERROR: Password must be above 4 characters and below 24.");
		dUserSetINT(pName(playerid)).("password_hash", udb_hash(pass));

        format(string, sizeof(string),"%s has changed their password.", PlayerName2(playerid) );
   	    MessageToAdmins(red,string);
   	    #if IRC_ENABLED == 1
        AddEcho(string); IRC_GroupSay(gGroupID, CREW_CHAN, string);
		#endif
		format(string, sizeof(string),"You have successfully changed your password to [%s]",pass);
		return SendClientMessage(playerid,yellow,string);
	} else return SendClientMessage(playerid,red, "Error: You must have an account to use this command");
}

CMD:setpass(playerid,params[])
{
    if(PlayerInfo[playerid][Level] >= 3)
	{
	    new string[128], pass[24], pID;
	    if(sscanf(params, "us[24]",pID, pass)) return SendClientMessage(playerid, Red, "USAGE: /setpass [PlayerID/Name]");
		if(strlen(pass) < 4 || strlen(pass) > 24) return SendClientMessage(playerid,red,"ERROR: Password must be above 4 characters and below 24");
		if(udb_Exists(pName(pID)))
		{
			dUserSetINT(pName(pID)).("password_hash", udb_hash(pass));
    	    format(string, sizeof(string),"You have successfully set %s's account password to [%s]", pName(pID), pass);
			return SendClientMessage(playerid,yellow,string);
		} else return SendClientMessage(playerid,red, "ERROR: This player doesnt have an account");
	} return 0;
}

CMD:stats(playerid,params[])
{
	new string[128], pDeaths, player1, h, m, s, file[MAX_PLAYER_NAME];
	if(sscanf(params, "u", player1)) return SendClientMessage(playerid,MAD_WHITE,"USAGE: /stats [playerid]");
	if(IsPlayerConnected(player1))
	{
	    if(PlayerInfo[player1][Registered] == 0) return SendClientMessage(playerid, Red, "This player is not registered.");
		if(IsPlayerNPC(player1)) return SendClientMessage(playerid, Red, "NPC's do not have stats.");
		if(player1 != playerid)
	    {
	        format(file,sizeof(file),"/lsx/users/%s.sav",udb_encode(pName(player1)));
	    	TotalGameTime(player1, h, m, s);
 			if(PlayerInfo[player1][Deaths] == 0) pDeaths = 1; else pDeaths = PlayerInfo[player1][Deaths];
 			SendClientMessage(playerid, White, "--------------------------------");
 			format(string, sizeof(string), "Showing public statistics for %s[%d]", pName(player1), player1);
 			SendClientMessage(playerid, DAYTONA_YELLOW, string);
 			format(string, sizeof(string), "%s has died %d times and has killed %d players making %s's ratio %0.2f",PlayerName2(player1), player1, PlayerInfo[player1][Kills], PlayerInfo[player1][Deaths], Float:PlayerInfo[player1][Kills]/Float:pDeaths);
 			SendClientMessage(playerid, White, string);
 			format(string, sizeof(string), "The registration date for %s is %d", pName(player1), dini_Get(file,"RegisteredDate"));
            SendClientMessage(playerid, White, string);
            SendClientMessage(playerid, White, "--------------------------------");
			return SendClientMessage(playerid, MAD_WHITE, string);
		}
		else
		{
		    SendClientMessage(playerid, Red, "ERROR: Use /my stats to check your own stats!");
		}
	} else return SendClientMessage(playerid, red, "Player Not Connected!");
	return 1;
}

new CmderName[MAX_PLAYER_NAME],cmdstr[128];

CMD:licence(playerid,params[])
{
	#pragma unused params
	new cash = GetPlayerMoney(playerid);
	new str[128];
	if(!IsInCheckPoint[playerid]) return SendClientMessage(playerid,red,"Error: You need to be in the checkpoint");
	if(cash < LICENCE_COST) return SendClientMessage(playerid, red,"Error: You don't have enough money!");
	if(dUserINT(PlayerName2(playerid)).("Licence") > 0) return SendClientMessage(playerid, red, "You already have the vehicle licence!");

	GivePlayerMoney(playerid,0-LICENCE_COST);
	if(PlayerInfo[playerid][Registered] && PlayerInfo[playerid][LoggedIn])
	{
		dUserSetINT(PlayerName2(playerid)).("Licence",1);
    	PlayerInfo[playerid][Licence] = dUserINT(PlayerName2(playerid)).("Licence");
	}
	else
	{
	    PlayerInfo[playerid][Licence] = 1;
	}
    SendClientMessage(playerid,MANAGEMENT,"** Successfully purchased the vehicle licence! Enjoy!");
    format(str,sizeof(str),"[ALERT] %s has purchased the vehicle licence", PlayerName2(playerid));
    MessageToAdmins(MAD_WHITE,str);
	return 1;
}

//-----------------------------------------------------------------------------------------------------------------------------------------------//



//-----------------------------------------------------------------------------------------------------------------------------------------------//

CMD:dive(playerid,params[])
{
    #pragma unused params

    if(GetPlayerInterior(playerid) > 0) return SendClientMessage(playerid,Red,"[Fail] You cannot dive when you're in an interior."); // if player is in an interior, the dive is stopped.
    if(PlayerDive[playerid]==1 || PlayerCardive[playerid]==1) return SendClientMessage(playerid,Red,"[Fail] You can only /dive once every 30 seconds.");

    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    SetPlayerPos(playerid,X,Y,Z+400);
    GivePlayerWeapon(playerid,46,1);
    GameTextForPlayer(playerid,"~b~Weeeeee!",3000,0);
    SendClientMessage(playerid,Green,"*** Don't forget to open your parachute on time!");

    GetPlayerName(playerid,CmderName,MAX_PLAYER_NAME);
    format(cmdstr,sizeof(cmdstr),"[ALERT] %s (%d) has used /dive.",CmderName,playerid);
    MessageToAdminsEx(playerid,red,cmdstr);
    printf(cmdstr);

	if(PlayerInfo[playerid][Level] < 2)
	{
        SetTimerEx("PlayerDiveCardiveTimer",30000,false,"i",playerid);
        PlayerDive[playerid]=1;PlayerCardive[playerid]=1;
		return 1;
	}

    return 1;
}

//-----------------------------------------------------------------------------------------------------------------------------------------------//

CMD:vdive(playerid,params[])
{
    #pragma unused params

    if(GetPlayerInterior(playerid) > 0) return SendClientMessage(playerid,Red,"[Fail] You cannot dive or vdive when you're in an interior."); // if player is in an interior, the dive is stopt.
    if(PlayerDive[playerid]==1 || PlayerCardive[playerid]==1) return SendClientMessage(playerid,Red,"[Fail] You can only /vdive once every 30 seconds.");
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,Red,"[Fail] You can only use this once every 30 seconds! And you're not in a vehicle!");

    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,Red,"[Fail] You need to be in a vehicle to use /vdive! Try /dive");
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return SendClientMessage(playerid,Red,"[Fail] You need to be the vehicle driver to use /vdive! Try /dive");

    new Float:Xv,Float:Yv,Float:Zv;
    new VehicleID=GetPlayerVehicleID(playerid);
    GetVehiclePos(VehicleID,Xv,Yv,Zv);
    SetVehiclePos(VehicleID,Xv,Yv,Zv+500);
    GameTextForPlayer(playerid,"~b~Weeeeee!",3000,0);
    SendClientMessage(playerid,Green,"*** Hope you brought your parachute!");

    GetPlayerName(playerid,CmderName,MAX_PLAYER_NAME);
    format(cmdstr,sizeof(cmdstr),"[ALERT] %s (%d) has used /vdive.",CmderName,playerid);
    MessageToAdminsEx(playerid,red,cmdstr);
    printf(cmdstr);

    if(PlayerInfo[playerid][Level] < 2) {
        SetTimerEx("PlayerDiveCardiveTimer",30000,false,"i",playerid);
        PlayerDive[playerid]=1;PlayerCardive[playerid]=1;
		return 1;
	}
    return 1;
}


//-----------------------------------------------------------------------------------------------------------------------------------------------//

//-----------------------------------------------------------------------------------------------------------------------------------------------//

CMD:tp(playerid,params[])
{
    if(PlayerInfo[playerid][LoggedIn])
    {
        new string[128], ObjectiveID, Float:X, Float:Y, Float:Z;
        if(sscanf(params, "u", ObjectiveID)) return SendClientMessage(playerid, Red, "USAGE: /tp [Name/ID]");
        {
            if(IsPlayerConnected(ObjectiveID))
            {
	    		if(PlayerTp[playerid] == 0 || PlayerCtp[playerid] == 0)
	    		{
	    		    if(PlayerInfo[ObjectiveID][Hidden] == 0)
	    		    {
	    		    	if(GetPlayerVirtualWorld(ObjectiveID) == GetPlayerVirtualWorld(playerid))
						{
							if(TeleBan[playerid] == 0)
							{
    							if(ObjectiveID != playerid)
    							{
									if(IsPlayerInAnyVehicle(playerid))
									{
									    SetVehicleToRespawn(GetPlayerVehicleID(playerid));
									}
									GetPlayerPos(ObjectiveID, X, Y, Z);
									SetPlayerPos(playerid, X+2, Y+3, Z);
									
									format(string, sizeof(string), "You have been teleported to %s[%d]", pName(ObjectiveID), ObjectiveID);
									SendClientMessage(playerid, MANAGEMENT, string);
									format(string, sizeof(string), "%s[%d] has been teleported to your position.", pName(playerid),playerid);
									SendClientMessage(ObjectiveID, MANAGEMENT, string);
									
								    if(PlayerInfo[playerid][Level] < 2)
									{
								        PlayerTp[playerid] = 1;
										PlayerCtp[playerid] = 1;
								        SetTimerEx("PlayerTpCtpTimer",60000,false,"i",playerid);
								        return 1;
									}
								}
								else
								{
								    SendClientMessage(playerid, Red, "ERROR: You cannot teleport to yourself!");
								}
							}
							else
							{
							    SendClientMessage(playerid, Red, "ERROR: You currently have no teleport ability, contact an admin for help. @Help, why can't I teleport?");
							}
						}
						else
						{
						    SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(ObjectiveID));
						}
					}
					else
					{
					    SendClientMessage(playerid, Red, "This person is not allowing teleporting to them.");
					}
				}
				else
				{
				    SendClientMessage(playerid, Red, "You can only use teleports once every few minutes. Please try again later.");
				}
			}
			else
			{
			    SendClientMessage(playerid, Red, "This player is not connected.");
			}
		}
	}
	else
	{
		LoginMsg(playerid);
	}
    return 1;
}

//-----------------------------------------------------------------------------------------------------------------------------------------------//

CMD:ctp(playerid,params[])
{
    if(PlayerInfo[playerid][LoggedIn])
    {
        new string[128], ObjectiveID, Float:X, Float:Y, Float:Z;
        if(sscanf(params, "u", ObjectiveID)) return SendClientMessage(playerid, Red, "USAGE: /ctp [Name/ID]");
        {
            if(IsPlayerConnected(ObjectiveID))
            {
	    		if(PlayerTp[playerid] == 0 || PlayerCtp[playerid] == 0)
	    		{
	    		    if(PlayerInfo[ObjectiveID][Hidden] == 0)
	    		    {
	    		    	if(GetPlayerVirtualWorld(ObjectiveID) == GetPlayerVirtualWorld(playerid))
						{
							if(TeleBan[playerid] == 0)
							{
    							if(ObjectiveID != playerid)
    							{
									if(IsPlayerInAnyVehicle(playerid))
									{
										GetPlayerPos(ObjectiveID, X, Y, Z);
										SetVehiclePos(GetPlayerVehicleID(playerid), X+2, Y+3, Z);
										format(string, sizeof(string), "You have been teleported to %s[%d]", pName(ObjectiveID), ObjectiveID);
										SendClientMessage(playerid, MANAGEMENT, string);
										format(string, sizeof(string), "%s[%d] has been teleported to your position.", pName(playerid),playerid);
										SendClientMessage(ObjectiveID, MANAGEMENT, string);

									    if(PlayerInfo[playerid][Level] < 2)
										{
									        PlayerTp[playerid] = 1;
											PlayerCtp[playerid] = 1;
									        SetTimerEx("PlayerTpCtpTimer",60000,false,"i",playerid);
									        return 1;
										}
									}
									else
									{
									    SendClientMessage(playerid, Red, "You need to be in a car to use this kind of teleport.");
									}
								}
								else
								{
								    SendClientMessage(playerid, Red, "ERROR: You cannot teleport to yourself!");
								}
							}
							else
							{
							    SendClientMessage(playerid, Red, "ERROR: You currently have no teleport ability, contact an admin for help. @Help, why can't I teleport?");
							}
						}
						else
						{
						    SetPlayerVirtualWorld(playerid,GetPlayerVirtualWorld(ObjectiveID));
						}
					}
					else
					{
					    SendClientMessage(playerid, Red, "This person is not allowing teleporting to them.");
					}
				}
				else
				{
				    SendClientMessage(playerid, Red, "You can only use teleports once every few minutes. Please try again later.");
				}
			}
			else
			{
			    SendClientMessage(playerid, Red, "This player is not connected.");
			}
		}
	}
	else
	{
		LoginMsg(playerid);
	}
    return 1;
}

//-----------------------------------------------------------------------------------------------------------------------------------------------//

CMD:givecash(playerid,params[])
{

    if(PlayerGivecash[playerid]==1)
	{
        if(GetPlayerMoney(playerid) <=0) return SendClientMessage(playerid,Red,"*** You can only send money once every 10 seconds. Also, you don't have any money!");

        SendClientMessage(playerid,Red,"*** You can only send money once every 10 seconds.");
	}

    new tmp[256],tmp2[256],idx,SenderName[MAX_PLAYER_NAME],ReceiverName[MAX_PLAYER_NAME],str1[128],str2[256],str3[128],str4[254],Receiver,SenderMoney,AmToSend;

    tmp=strtok(params,idx);

    if(!strlen(tmp)) return SendClientMessage(playerid,Red,"Use: /givecash (id) (amount)");
    if(!IsNumeric(tmp)) return SendClientMessage(playerid,Red,"Use: /givecash (id) (amount)");

    Receiver=strval(tmp);

    if(!IsPlayerConnected(Receiver)) return SendClientMessage(playerid,Red,"*** That player isn't connected!");
    if(Receiver==playerid) return SendClientMessage(playerid,Red,"*** You can't send money to yourself! Damnit -.-");

    tmp2=strtok(params,idx);

    if(!strlen(tmp2)) return SendClientMessage(playerid,Red,"Use: /givecash (id) (amount)");
    if(!IsNumeric(tmp2)) return SendClientMessage(playerid,Red,"Use: /givecash (id) (amount)");

    AmToSend=strval(tmp2);
    SenderMoney=GetPlayerMoney(playerid);

    if(SenderMoney<=0) return SendClientMessage(playerid,Red,"*** You don't have any money!");
    if(SenderMoney<AmToSend) return SendClientMessage(playerid,Red,"*** You don't have all that money!");

    GetPlayerName(playerid,SenderName,MAX_PLAYER_NAME);
    GetPlayerName(Receiver,ReceiverName,MAX_PLAYER_NAME);

    GivePlayerMoney(Receiver,AmToSend);
    GivePlayerMoney(playerid,0-AmToSend);

    format(str1,sizeof(str1),"*** %s (%d) has sent you $%d!",SenderName,playerid,AmToSend);
    format(str2,sizeof(str2),"*** You have sent $%d to %s (%d)!",AmToSend,ReceiverName,Receiver);
    format(str3,sizeof(str3),"[Command] %s (%d) has sent $%d to %s (%d).",SenderName,playerid,AmToSend,ReceiverName,Receiver);
	format(str4,sizeof(str4),"[ALERT] %s sent $%d to %s",SenderName,AmToSend,ReceiverName);
    SendClientMessage(playerid,Green,str2);
    SendClientMessage(Receiver,Green,str1);
    printf(str3);
    MessageToAdminsEx(playerid,red,str4);

    PlayerGivecash[playerid]=1;
    SetTimerEx("PlayerGivecashTimer",10000,false,"i",playerid);
    return 1;
}

//-----------------------------------------------------------------------------------------------------------------------------------------------//

CMD:chase(playerid, params[])
{
    #pragma unused params
	if(PlayerInfo[playerid][Level] >= 3)
	{
        if(IsGameOn == 1) return SendClientMessage(playerid,red,"The minigame is already on!");
        StartHitman();
        return 1;
	} else return 0;
}

CMD:endchase(playerid, params[])
{
    #pragma unused params
    if(PlayerInfo[playerid][Level] >= 3)
	{
        if(IsGameOn == 0) return SendClientMessage(playerid,red,"The minigame is already off!");
        format(lolz,128,"%s has escaped! The minigame is over!",PlayerName3(playerid));
        SendClientMessageToAll(red,lolz);
        SendClientMessage(playerid,yellow,"*** You have successfully ended the hitman minigame.");
        GameTextForAll("~y~The chase is over!",5000,1);
        EndHitman();
        return 1;
	} else return 0;
}




//----------------------------------------------------------------------------//
forward HighLight(playerid);
public HighLight(playerid)
{
	if(!IsPlayerConnected(playerid)) return 1;
	if(PlayerInfo[playerid][blipS] == 0) { SetPlayerColor(playerid, 0xFF0000AA); PlayerInfo[playerid][blipS] = 1; }
	else { SetPlayerColor(playerid, 0x33FF33AA); PlayerInfo[playerid][blipS] = 0; }
	return 0;
}

//----------------------------------------------------------------------------//


LoginPlayer(playerid)
{
	if(ServerInfo[GiveMoney] == 1) {ResetPlayerMoney(playerid); GivePlayerMoney(playerid, dUserINT(PlayerName2(playerid)).("money") ); }
	dUserSetINT(PlayerName2(playerid)).("loggedin",1);
	PlayerInfo[playerid][Deaths] = (dUserINT(PlayerName2(playerid)).("deaths"));
	PlayerInfo[playerid][Kills] = (dUserINT(PlayerName2(playerid)).("kills"));
 	PlayerInfo[playerid][Level] = (dUserINT(PlayerName2(playerid)).("level"));
	PlayerInfo[playerid][Regular] = (dUserINT(PlayerName2(playerid)).("Regular"));
    PlayerInfo[playerid][hours] = dUserINT(PlayerName2(playerid)).("hours");
    PlayerInfo[playerid][Bank] = dUserINT(PlayerName2(playerid)).("Bank");
    PlayerInfo[playerid][xAccount] = (dUserINT(PlayerName2(playerid)).("xAccount"));
   	PlayerInfo[playerid][mins] = dUserINT(PlayerName2(playerid)).("minutes");
   	PlayerInfo[playerid][secs] = dUserINT(PlayerName2(playerid)).("seconds");
   	PlayerInfo[playerid][Licence] = dUserINT(PlayerName2(playerid)).("Licence");
   	PlayerInfo[playerid][CarKey] = (dUserINT(PlayerName2(playerid)).("CarKey"));
   	PlayerInfo[playerid][Developer] = dUserINT(PlayerName2(playerid)).("Developer");
   	PlayerInfo[playerid][Cookies] = dUserINT(PlayerName2(playerid)).("Cookies");
   	PlayerInfo[playerid][SpawnColour] = dUserINT(PlayerName2(playerid)).("SpawnColour");
   	//PlayerInfo[playerid][UseSkin] = dUserINT(PlayerName2(playerid)).("UseSkin");
   	PlayerInfo[playerid][HoldingObject] = dUserINT(PlayerName2(playerid)).("HoldingObject");
   	PlayerInfo[playerid][ObjectStatus] = dUserINT(PlayerName2(playerid)).("ObjectStatus");
   	PlayerInfo[playerid][AutoFix] = dUserINT(PlayerName2(playerid)).("AutoFix");
   	PlayerInfo[playerid][TeleMsg] = dUserINT(PlayerName2(playerid)).("TeleMsg");
   	PlayerInfo[playerid][MyTime] = dUserINT(PlayerName2(playerid)).("MyTime");
   	PlayerInfo[playerid][MyHour] = dUserINT(PlayerName2(playerid)).("MyHour");
   	PlayerInfo[playerid][FavSkin] = dUserINT(PlayerName2(playerid)).("FavSkin");
   	PlayerInfo[playerid][FavSkin] = dUserINT(PlayerName2(playerid)).("FavSkin");
	PlayerInfo[playerid][Registered] = 1;
 	PlayerInfo[playerid][LoggedIn] = 1;
 	TextDrawShowForPlayer(playerid, LevelText[playerid]);
}

ModLogin(playerid, string[])
{
	//if(ServerInfo[GiveMoney] == 1) {ResetPlayerMoney(playerid); GivePlayerMoney(playerid, dUserINT(PlayerName2(playerid)).("money") ); }
	//dUserSetINT(PlayerName2(playerid)).("loggedin",1);
	//PlayerInfo[playerid][Deaths] = (dUserINT(string).("deaths"));
	//PlayerInfo[playerid][Kills] = (dUserINT(name).("kills"));
 	PlayerInfo[playerid][Level] = (dUserINT(string).("level"));
	PlayerInfo[playerid][Regular] = (dUserINT(string).("Regular"));
    //PlayerInfo[playerid][hours] = dUserINT(name).("hours");
    //PlayerInfo[playerid][Bank] = dUserINT(name).("Bank");
    //PlayerInfo[playerid][xAccount] = (dUserINT(name).("xAccount"));
   	//PlayerInfo[playerid][mins] = dUserINT(name).("minutes");
   	//PlayerInfo[playerid][secs] = dUserINT(name).("seconds");
   	PlayerInfo[playerid][Licence] = dUserINT(string).("Licence");
   	//PlayerInfo[playerid][CarKey] = (dUserINT(name).("CarKey"));
   	//PlayerInfo[playerid][Developer] = dUserINT(name).("Developer");
   	//PlayerInfo[playerid][Cookies] = dUserINT(name).("Cookies");
   	//PlayerInfo[playerid][SpawnColour] = dUserINT(name).("SpawnColour");
   	//PlayerInfo[playerid][UseSkin] = dUserINT(name).("UseSkin");
   	PlayerInfo[playerid][MyTime] = dUserINT(string).("MyTime");
   	PlayerInfo[playerid][MyHour] = dUserINT(string).("MyHour");
	PlayerInfo[playerid][Registered] = 1;
 	PlayerInfo[playerid][LoggedIn] = 1;
 	TextDrawShowForPlayer(playerid, LevelText[playerid]);
}

//==============================================================================
public OnPlayerCommandText(playerid, cmdtext[])
{
	return 1;
}

public OnPlayerCommandReceived(playerid, cmdtext[])
{
    if(PlayerInfo[playerid][Jailed] == 1 && PlayerInfo[playerid][Level] < 2) return
	    SendClientMessage(playerid,red,"You cannot use commands in jail");

	if(pGame[playerid] && PlayerInfo[playerid][Level] < 2)
	{
	    SendClientMessage(playerid, Red, "You cannot use commands whilst in a minigame. Type /kill to exit!");
	}

    if(PlayerHitman[playerid] == 1 && PlayerInfo[playerid][Level] < 2) return
        SendClientMessage(playerid,red,"You cannot use commands whilst being chased!");

	new cmd[256], string[128], tmp[256], idx;
	cmd = strtok(cmdtext, idx);

    if(afkdude[playerid] == 1 && PlayerInfo[playerid][Level] < 2)
	{
        if(strcmp(cmd, "/play", true) == 0)
        {
        }
		else
		{
		     SendClientMessage(playerid,red,"Error: You cannot use commands when you're AFK. Type /play to start playing again!");
		     return 1;
  		}
	}
	if(AdminWorld[playerid] != 0 && PlayerInfo[playerid][Level] < 1338)
	{
	    if(strcmp(cmd, "/return", true) == 0 || strcmp(cmd, "/god", true) == 0)
	    {
	    }
	    else
	    {
	        SendClientMessage(playerid, red, "ERROR: You cannot use this command whilst in Admin locations!");
			return 1;
		}
	}

	//================ [ Read Commands ] ===========================//
	if(ServerInfo[ReadCmds] == 1)
	{
		format(string, sizeof(string), "*** %s (%d) typed: %s", pName(playerid),playerid,cmdtext);
		for(new i = 0; i < MAX_PLAYERS; i++)
		{
			if(IsPlayerConnected(i))
			{
				if( (PlayerInfo[i][Level] > PlayerInfo[playerid][Level]) && (PlayerInfo[i][Level] > 1) && (i != playerid) ) {
					SendClientMessage(i, grey, string);
				}
			}
		}
	}


    if(strcmp(cmd, "/play", true) == 0)
    {
		if(afkdude[playerid] == 0) return SendClientMessage(playerid,red,"Error: You're not AFK!");

		NowBack(playerid);
		new str[128];
		format(str,sizeof(str),"** %s is back from AFK", PlayerName2(playerid));
		MessageToAdmins(red,str);
		return 1;
	}
	if(strcmp(cmd, "/away", true) == 0)
	{
		if(afkdude[playerid] == 1) return SendClientMessage(playerid,red,"Error: You're already away. /play to continue");

		NowAFK(playerid);
		new str[128];
		format(str,sizeof(str),"** %s is AFK", PlayerName2(playerid));
		MessageToAdmins(red,str);
		return 1;
	}

//------------------------------------------------------------------------------
//                      Remote Console
//------------------------------------------------------------------------------

	if(strcmp(cmd, "/loadfs", true) == 0)
	{
	    if(PlayerInfo[playerid][Level] >= 5)
		{
    		new str[128]; format(str,sizeof(string),"loadfs %s",cmdtext[1]); SendRconCommand(str);
		    return SendClientMessage(playerid,COLOR_WHITE,"RCON Command Sent");
	   	} else return 0;
	}

	if(strcmp(cmd, "/unloadfs", true) == 0)
	{
	    if(PlayerInfo[playerid][Level] >= 5)
		{
    		new str[128]; format(str,sizeof(string),"unloadfs %s",cmdtext[1]); SendRconCommand(str);
		    return SendClientMessage(playerid,COLOR_WHITE,"RCON Command Sent");
	   	} else return 0;
	}

	if(strcmp(cmd, "/changemode", true) == 0)
	{
	    if(PlayerInfo[playerid][Level] >= 5)
		{
    		new str[128]; format(str,sizeof(string),"changemode %s",cmdtext[1]); SendRconCommand(str);
		    return SendClientMessage(playerid,COLOR_WHITE,"RCON Command Sent");
	   	} else return 0;
	}

	if(strcmp(cmd, "/gmx", true) == 0)
	{
		if(PlayerInfo[playerid][Level] >= 5)
		{
	        SetTimer("RestartGM",30000,0);
			SendClientMessageToAll(Red,"-----------------------------------");
	        SendClientMessageToAll(DAYTONA_YELLOW," Los Santos Xtreme will be having a quick restart in 30 seconds");
            SendClientMessageToAll(DAYTONA_YELLOW, " This is to apply new updates and refresh the server - LSX Crew.");
	        SendClientMessageToAll(Red,"-----------------------------------");
			CreateCountdown(30, 0);
			return SendClientMessage(playerid,COLOR_WHITE,"Commencing GMX timer.");
		} else return 0;
	}

	//------------------------ Banking ---------------------------------------//

    if(strcmp(cmd, "/account", true) == 0)
	{
		new accountvar;
		tmp = strtok(cmdtext, idx);
		if(InBankCheckpoint[playerid] == 0)
		{
			SendClientMessage(playerid,red,"You need to be at the bank and in the checkpoint to use this!");
			return 1;
		}
		if(!strlen(tmp))
		{
			SendClientMessage(playerid,MAD_WHITE,"USAGE: /account [upgrade/setlimit/reset/reward]");
			return 1;
		}

		if(strcmp(tmp, "upgrade", true) == 0)
			accountvar = 1;
		else if(strcmp(tmp, "setlimit", true) == 0)
			accountvar = 2;
		else if(strcmp(tmp, "reset", true) == 0)
			accountvar = 3;
		else if(strcmp(tmp, "reward", true) == 0)
			accountvar = 4;

        tmp = strtok(cmdtext, idx);
		if(accountvar == 1)
		{
		    new cash = GetPlayerMoney(playerid);
            if(PlayerInfo[playerid][xAccount] == 1)
			{
			    SendClientMessage(playerid,red,"You have already upgraded your account!");
			    return 1;
		    }
		    if(cash < xACCOUNT_COST)
			{
			    new str[254];
			    format(str,sizeof(str),"You don't have enough money! The xAccount costs $%d",xACCOUNT_COST);
			    SendClientMessage(playerid,red,str);
			    return 1;
	        }
			SendClientMessage(playerid,MANAGEMENT,"Banking plan upgraded to the xAccount! You can now /bank, /withdraw or check your /balance on the fly!");
			dUserSetINT(PlayerName2(playerid)).("xAccount",1);
            PlayerInfo[playerid][xAccount] = dUserINT(PlayerName2(playerid)).("xAccount");
            GivePlayerMoney(playerid,0-xACCOUNT_COST);
            return 1;

		} else if(accountvar == 2)
		{
            if(PlayerInfo[playerid][xAccount] == 0)
			{
			    SendClientMessage(playerid,MAD_WHITE,"You cannot set your bank limit with this banking plan!");
			    return 1;
		    }
			SendClientMessage(playerid,red,"Service in development!");
			return 1;

		} else if(accountvar == 3)
		{
			SendClientMessage(playerid,MANAGEMENT,"Account successfully cleared of all funds");
			dUserSetINT(PlayerName2(playerid)).("Bank",0);
            PlayerInfo[playerid][Bank] = dUserINT(PlayerName2(playerid)).("Bank");
            return 1;

		}
		else if(accountvar == 4)
		{

            new str[128];
			new cooky = PlayerInfo[playerid][Cookies];

            if(cooky < 25 || cooky == 0)
			{
			    format(str,sizeof(str),"You don't have enough cookies, you need at least 25. You currently have %d", cooky);
			    SendClientMessage(playerid,red,str);
			    return 1;
		    }
			if(cooky > 24 && cooky < 50)
			{
				GivePlayerMoney(playerid,10000000);
				format(str,sizeof(str),"You were rewarded $10,000,000 for earning %d cookies!", cooky);

				return 1;

			}
			else if(cooky > 49 && cooky < 100)
			{
                GivePlayerMoney(playerid,25000000);
				format(str,sizeof(str),"You were rewarded $25,000,000 for earning %d cookies!", cooky);

				return 1;

			}
			else if(cooky > 99 && cooky < 175)
			{
                GivePlayerMoney(playerid,50000000);
				format(str,sizeof(str),"You were rewarded $50,000,000 for earning %d cookies!", cooky);

				return 1;

			}
			else if(cooky > 174)
			{
                GivePlayerMoney(playerid,100000000);
				format(str,sizeof(str),"You were rewarded $100,000,000 for earning %d cookies!", cooky);

				return 1;
			}
			SendClientMessage(playerid,MANAGEMENT,str);
			dUserSetINT(PlayerName2(playerid)).("Cookies",0);
   			PlayerInfo[playerid][Cookies] = dUserINT(PlayerName2(playerid)).("Cookies");
		}
		return 1;
	}
	// -------------------- Watch-Cams ------------------//
	if (strcmp("/viewcam", cmdtext, true) == 0)
	{
		if(PlayerInfo[playerid][Level] < 2) return 0;
		if(Spawned2[playerid] == 1)
		{
		    PlayerMenu[playerid] = 0;
		    TogglePlayerControllable(playerid, 0);
			ShowMenuForPlayer(CCTVMenu[0], playerid);
		}
		else
		{
		    SendClientMessage(playerid, red, "Please spawn first!");
		}
		return 1;
	}

	if (strcmp("/camoff", cmdtext, true) == 0)
	{
        if(PlayerInfo[playerid][Level] < 2) return 0;
	    if(CurrentCCTV[playerid] > -1)
	    {
		    SetPlayerPos(playerid, LastPos[playerid][LX], LastPos[playerid][LY], LastPos[playerid][LZ]);
			SetPlayerFacingAngle(playerid, LastPos[playerid][LA]);
	        SetPlayerInterior(playerid, LastPos[playerid][LInterior]);
		    TogglePlayerControllable(playerid, 1);
		    KillTimer(KeyTimer[playerid]);
		    SetCameraBehindPlayer(playerid);
		    TextDrawHideForPlayer(playerid, TD);
            CurrentCCTV[playerid] = -1;
            return 1;
		}
		return 1;
	}
	// ------------------ Gang commands --------------------------------------//
	if(strcmp(cmd, "/gang", true) == 0)
	{
	    new gangcmd, gangnum;
    	new sendername[MAX_PLAYER_NAME];
		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [create/join/invite/quit] [name/number]");
			return 1;
		}
		new giveplayerid;
		giveplayerid = strval(tmp);

		if(strcmp(tmp, "create", true)==0)
		    gangcmd = 1;
		else if(strcmp(tmp, "invite", true)==0)
		    gangcmd = 2;
		else if(strcmp(tmp, "join", true)==0)
		    gangcmd = 3;
		else if(strcmp(tmp, "quit", true)==0)
		    gangcmd = 4;

		tmp = strtok(cmdtext, idx);
		if(gangcmd < 3 && !strlen(tmp))
		{
		    if(gangcmd==0)
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [create/join/invite/quit] [name/number]");
			else if(gangcmd==1)
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [create] [name]");
			else if(gangcmd==2)
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gang [invite] [playerID]");
			return 1;
		}

		//Create Gang//
		if(gangcmd==1) {
		    if(playerGang[playerid]>0) {
				SendClientMessage(playerid, red, "You are already in a gang!");
				return 1;
		    }

			for(new i = 1; i < MAX_GANGS; i++)
			{
				if(gangInfo[i][0]==0)
				{
				    //name gang
					format(gangNames[i], MAX_GANG_NAME, "%s", tmp);
					//Gang exists
					gangInfo[i][0]=1;
					//There is one member
					gangInfo[i][1]=1;
					//Gang color is player's color
					gangInfo[i][2]=GetPlayerColor(playerid);

					//Player is the first gang member
					gangMembers[i][0] = playerid;
					format(string, sizeof(string),"You have created the gang '%s' (id: %d)", gangNames[i], i);
					SendClientMessage(playerid, COLOR_GREEN, string);

					playerGang[playerid]=i;

					return 1;
				}
			}

		//Join Gang//
		} else if (gangcmd==3)
		{
	 		gangnum = gangInvite[playerid];

		    if(playerGang[playerid]>0)
			{
				SendClientMessage(playerid, Red, "You are already in a gang!");
				return 1;
		    }
	 		if(gangInvite[playerid]==0)
		 	{
				SendClientMessage(playerid, Red, "You have not been invited to a gang.");
				return 1;
			}
			if(gangInfo[gangnum][0]==0)
			{
				SendClientMessage(playerid, Red, "That gang does not exist!");
				return 1;
			}

			if(gangInfo[gangnum][1] < MAX_GANG_MEMBERS)
			{
			    new i = gangInfo[gangnum][1];

				gangInvite[playerid]=0;

				gangMembers[gangnum][i] = playerid;

			    GetPlayerName(playerid, sendername, MAX_PLAYER_NAME);
				for(new j = 0; j < gangInfo[gangnum][1]; j++)
				{
					format(string, sizeof(string),"%s has joined your gang.", sendername);
					SendClientMessage(gangMembers[gangnum][j], COLOR_ORANGE, string);
				}

				gangInfo[gangnum][1]++;
				playerGang[playerid] = gangnum;

				SetPlayerColor(playerid,gangInfo[gangnum][2]);

				format(string, sizeof(string),"You have joined the gang '%s' (id: %d)", gangNames[gangnum], gangnum);
				SendClientMessage(playerid, COLOR_GREEN, string);

				return 1;
			}

			SendClientMessage(playerid, Red, "That gang is full.");
			return 1;

		//Invite to Gang//
		}
		else if (gangcmd==2)
		{
	 		giveplayerid = strval(tmp);

			if(playerGang[playerid]==0)
			{
				SendClientMessage(playerid, Red, "You're not in a gang!");
				return 1;
			}
			if(giveplayerid == playerid) return SendClientMessage(playerid,red,"You're already in the gang!");
			if(giveplayerid == playerGang[playerid]) return SendClientMessage(playerid,red,"That player is already in your gang!");
//   if(gangMembers[playerGang[playerid]][0]!=playerid) {
//				SendClientMessage(playerid, COLOR_RED, "You need to be the gang leader to send an invite.");
//				return 1;
//			}

			if(IsPlayerConnected(giveplayerid))
			{
 		        new giveplayer[MAX_PLAYER_NAME];
				GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
				GetPlayerName(playerid, sendername, sizeof(sendername));

				format(string, sizeof(string),"You have sent a gang invite to %s.", giveplayer);
				SendClientMessage(playerid, COLOR_GREEN, string);
				format(string, sizeof(string),"You have recieved a gang invite from %s to '%s' (id: %d)", sendername, gangNames[playerGang[playerid]],playerGang[playerid]);
				SendClientMessage(giveplayerid, COLOR_GREEN, string);

				gangInvite[giveplayerid]=playerGang[playerid];

			}
			else
			{
				SendClientMessage(playerid, Red, "No such player exists!");
			}
		//Leave Gang//
		}
		else if (gangcmd==4)
		{
		    PlayerLeaveGang(playerid);
        }
        return 1;
	}

	//------------------- /ganginfo

	if(strcmp(cmd, "/ganginfo", true) == 0) {
	    new gangnum;
   		new giveplayer[MAX_PLAYER_NAME];
		tmp = strtok(cmdtext, idx);

		if(!strlen(tmp) && playerGang[playerid]==0)
		{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /ganginfo [number]");
			return 1;
		}
		else if (!strlen(tmp))
			gangnum = playerGang[playerid];
		else
			gangnum = strval(tmp);

		if(gangInfo[gangnum][0]==0)
		{
			SendClientMessage(playerid, Red, "No such gang exists!");
			return 1;
		}

		format(string, sizeof(string),"'%s' Gang Members (id: %d)", gangNames[gangnum], gangnum);
		SendClientMessage(playerid, COLOR_GREEN, string);

		for(new i = 0; i < gangInfo[gangnum][1]; i++)
		{
			GetPlayerName(gangMembers[gangnum][i], giveplayer, sizeof(giveplayer));
			format(string, sizeof(string),"%s (%d)", giveplayer, gangMembers[gangnum][i]);
			SendClientMessage(playerid, DAYTONA_YELLOW, string);
		}
		return 1;
	}

	//------------------- /gangs

	if(strcmp(cmd, "/gangs", true) == 0)
	{
		new x;

		SendClientMessage(playerid, COLOR_GREEN, "Current Gangs:");
	    for(new i=0; i < MAX_GANGS; i++)
		{
			if(gangInfo[i][0]==1)
			{
				format(string, sizeof(string), "%s%s(%d) - %d members", string,gangNames[i],i,gangInfo[i][1]);

				x++;
				if(x > 2)
				{
				    SendClientMessage(playerid, DAYTONA_YELLOW, string);
				    x = 0;
					format(string, sizeof(string), "");
				}
				else
				{
					format(string, sizeof(string), "%s, ", string);
				}
			}
		}

		if(x <= 2 && x > 0)
		{
			string[strlen(string)-2] = '.';
		    SendClientMessage(playerid, DAYTONA_YELLOW, string);
		}
		return 1;
	}
		//------------------- /hitman

	if(strcmp(cmd, "/hitman", true) == 0)
	{
		tmp = strtok(cmdtext, idx);
        new moneys;
        new giveplayerid;
        new giveplayer[MAX_PLAYER_NAME];    	new sendername[MAX_PLAYER_NAME];
		GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
		GetPlayerName(playerid, sendername, sizeof(sendername));
		giveplayerid = strval(tmp);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hitman [playerid] [amount]");
			return 1;
		}

		tmp = strtok(cmdtext, idx);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /hitman [playerid] [amount]");
			return 1;
		}
 		moneys = strval(tmp);

	    if(moneys > GetPlayerMoney(playerid))
		{
			SendClientMessage(playerid, Red, "You don't have enough money!");
			return 1;
	    }
	    if(moneys < 1)
		{
			SendClientMessage(playerid, DAYTONA_YELLOW, "Hey what are you trying to pull here.");
			return 1;
		}
		if(IsPlayerConnected(giveplayerid)==0) {
			SendClientMessage(playerid, Red, "No such player exists.");
			return 1;
		}

		bounty[giveplayerid]+=moneys;
		GivePlayerMoney(playerid, 0-moneys);

		GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
		GetPlayerName(playerid, sendername, sizeof(sendername));


		format(string, sizeof(string), "%s has had a $%d bounty put on his head from %s (total: $%d).", giveplayer, moneys, sendername, bounty[giveplayerid]);
		SendClientMessageToAll(COLOR_ORANGE, string);

		#if defined IRC_ON_PLZ
		new istr[254];
		format(istr, sizeof(istr), "4%s has had a $%d bounty put on his head from %s (total: $%d).", giveplayer, moneys, sendername, bounty[giveplayerid]);
		ircSay(EchoConnection, EchoChan, istr);
		#endif

		format(string, sizeof(string), "You have had a $%d bounty put on you from %s (id: %d).", moneys, sendername, playerid);
		SendClientMessage(giveplayerid, Red, string);
		return 1;
	}

	//------------------- /bounty

	if(strcmp(cmd, "/bounty", true) == 0)
	{
		tmp = strtok(cmdtext, idx);
        new giveplayerid;
        new giveplayer[MAX_PLAYER_NAME];    	new sendername[MAX_PLAYER_NAME];
		GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
		GetPlayerName(playerid, sendername, sizeof(sendername));
		giveplayerid = strval(tmp);
		if(!strlen(tmp))
		{
			SendClientMessage(playerid, COLOR_WHITE, "USAGE: /bounty [playerid]");
			return 1;
		}

		if(IsPlayerConnected(giveplayerid))
		{
			GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
			format(string, sizeof(string), "Player %s (id: %d) has a  $%d bounty on his head.", giveplayer,giveplayerid,bounty[giveplayerid]);
			SendClientMessage(playerid, DAYTONA_YELLOW, string);
		}
		else
		{
			SendClientMessage(playerid, Red, "No such player exists!");
		}

		return 1;
	}

	//------------------- /bounties

	if(strcmp(cmd, "/bounties", true) == 0)
	{
		new x;
        new giveplayerid;
        new giveplayer[MAX_PLAYER_NAME];    	new sendername[MAX_PLAYER_NAME];
		GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
		GetPlayerName(playerid, sendername, sizeof(sendername));
		giveplayerid = strval(tmp);

		SendClientMessage(playerid, COLOR_GREEN, "Current Bounties:");
	    for(new i=0; i < MAX_PLAYERS; i++) {
			if(IsPlayerConnected(i) && bounty[i] > 0)
			{
				GetPlayerName(i, giveplayer, sizeof(giveplayer));
				format(string, sizeof(string), "%s%s(%d): $%d", string,giveplayer,i,bounty[i]);

				x++;
				if(x > 3)
				{
				    SendClientMessage(playerid, DAYTONA_YELLOW, string);
				    x = 0;
					format(string, sizeof(string), "");
				}
				else
				{
					format(string, sizeof(string), "%s, ", string);
				}
			}
		}

		if(x <= 3 && x > 0)
		{
			string[strlen(string)-2] = '.';
		    SendClientMessage(playerid, DAYTONA_YELLOW, string);
		}

		return 1;
	}
	return 0;
}
//==============================================================================

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
/*
	new x = 0;
	while(x!=MAX_PLAYERS) {
	    if( IsPlayerConnected(x) &&	GetPlayerState(x) == PLAYER_STATE_SPECTATING &&
			PlayerInfo[x][SpecID] == playerid && PlayerInfo[x][SpecType] == ADMIN_SPEC_TYPE_PLAYER )
   		{
   		    SetPlayerInterior(x,newinteriorid);
		}
		x++;
	}
*/
	if (oldinteriorid == 12 && InVipRoom[playerid] == 1 && PlayerInfo[playerid][Level] >= 1)
	{
		SetPlayerPos(playerid,1653.9008,-1664.2389,22.2441);
	    SetPlayerFacingAngle(playerid,181.823);
	    InVipRoom[playerid] = 0;
	    SetPlayerInterior(playerid, 0);
        SendClientMessage(playerid,MANAGEMENT,"*** Exited V.I.P. Room! Have fun!");
        new string[128]; format(string, sizeof(string),"[ALERT] %s has left the V.I.P. Lounge!",PlayerName2(playerid));
   	    MessageToAdmins(red,string);
   	    return 1;
    }
	return 1;
}

//==============================================================================
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
/*
	if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && PlayerInfo[playerid][SpecID] != INVALID_PLAYER_ID)
	{
		if(newkeys == KEY_JUMP) AdvanceSpectate(playerid);
		else if(newkeys == KEY_SPRINT) ReverseSpectate(playerid);
	}
*/
	if(newkeys == KEY_SECONDARY_ATTACK)
	{
	    new Float:X, Float:Y, Float:Z; GetVehiclePos(aVehicle[10], X, Y, Z);
		if(IsPlayerInRangeOfPoint(playerid, 1.0, X,Y,Z))
		{
		    if(IsPlayerAdmin(playerid) || PlayerInfo[playerid][Level] >= 2)
		    {
				if(!IsPlayerInAnyVehicle(playerid))
				{
		        	PutPlayerInVehicle(playerid,aVehicle[10],0);
		        	SendClientMessage(playerid, MANAGEMENT, "Welcome to the Administration mini-tank. Use KEY_FIRE to blow stuff up.");
				}
				else
				{
				    new vID = GetPlayerVehicleID(playerid);
				    if(vID == aVehicle[10])
				    {
				        GetPlayerPos(playerid, X, Y, Z);
				        SetPlayerPos(playerid, X+1, Y+1, Z);
					}
					else
					{
					    return 1;
					}
				}
			}
		}
	}
    if(newkeys == KEY_FIRE || newkeys == KEY_FIRE && KEY_SPRINT)
	{
	 	if(IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
		{
		    if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 564)
			{
				new Float:x,Float:y,Float:z,Float:x2,Float:y2,Float:az;
				GetPlayerPos(playerid,x,y,z);
				GetVehicleZAngle(GetPlayerVehicleID(playerid), az);
				x2 = x + (30 * floatsin(-az+5, degrees));
				y2 = y + (30 * floatcos(-az+5, degrees));
				CreateExplosion(x2,y2,z,3,4.0);
			}
		}
	}
	if(newkeys==KEY_CROUCH && !IsPlayerInAnyVehicle(playerid) && PlayerInfo[playerid][Level] < 2)
	{
	    new Float:X, Float:Y, Float:Z;
	    SetPlayerVelocity(playerid, X, Y, Z+0.1);
	}
	return 1;
}

//========================== Wanted mission - Jerome =========================
/*
public ExportChange()
{
	new vString[4];
	vString[0] = random(sizeof(VehicleNames));
	format(vIDExport[0], 54, "%s", VehicleNames[vString[0]]);
	CurrentExportID[0] = GetVehicleModelIDFromName(vIDExport[0]);
	
	vString[1] = random(sizeof(VehicleNames)-2);
	format(vIDExport[1], 54, "%s", VehicleNames[vString[1]]);
	CurrentExportID[1] = GetVehicleModelIDFromName(vIDExport[1]);
	
	vString[2] = random(sizeof(VehicleNames)-5);
	format(vIDExport[2], 54, "%s", VehicleNames[vString[2]]);
	CurrentExportID[2] = GetVehicleModelIDFromName(vIDExport[2]);
	
	vString[3] = random(sizeof(VehicleNames)-10);
	format(vIDExport[3], 54, "%s", VehicleNames[vString[3]]);
	CurrentExportID[3] = GetVehicleModelIDFromName(vIDExport[3]);
	
	#if DEBUG == 1
	print("DEBUG: Executed function: ExportChange()");
	#endif
	return 1;
}
*/
forward CExport__NewWantedVehicle();
public CExport__NewWantedVehicle()
{
	// Choose a new vehicle that shall be exported.
	new vehID, vehFound[3], bFoo = 1, done[ 3 ];
	for (new i = 0; i < 3; i++)
	{
		while( bFoo )
		{
			vehID = wantedVehicles[ random( MAX_WANTEDVEH ) ];
			if (done[ 0 ] != vehID && done[ 1 ] != vehID && vehID > 400 && vehID < 610)
			break;
		}

		// Make sure we get no doubles
		done [ i ] = vehID;
	}

	// Check the total amount of vehicles available.
	for (new i = 0; i < 580; i++)
	{
		new iModelID = GetVehicleModel( i );
		if (iModelID == -1) continue;

		if(iModelID == done[ 0 ])
		{
			if(vehFound[0] < 15)
		    {
				vehFound[0]++;
			}
		}
		if(iModelID == done[ 1 ])
		{
			if(vehFound[1] < 15)
		    {
				vehFound[1]++;
			}
		}
		if (iModelID == done[ 2 ])
		{
		    if(vehFound[2] < 15)
		    {
				vehFound[2]++;
			}
		}
	}

	// Copy information about the cars being exported
	wantedVehicle[ 0 ] = done[ 0 ];
	wantedVehicle[ 1 ] = done[ 1 ];
	wantedVehicle[ 2 ] = done[ 2 ];
	amountWantedVehicle[ 0 ] = vehFound[ 0 ];
	amountWantedVehicle[ 1 ] = vehFound[ 1 ];
	amountWantedVehicle[ 2 ] = vehFound[ 2 ];

	// Format a message to send to all the players;
	new szMessage[ 256 ];
	format( szMessage, sizeof( szMessage ), ""COL_EXPORT"* Current Exports: "COL_WHITE"%s", "" );

	for (new i = 0; i < 3; i++)
	{
		format( szMessage, sizeof( szMessage ), ""COL_WHITE"%s   %s (%d needed)", szMessage, VehicleNames[ ( done[ i ] - 400 ) ], vehFound[i] );
	}

	// // Format the last part, and send the message to everyone.
	SendClientMessageToAll(White, szMessage );
	SendClientMessageToAll(White, "* And remember, we don't take trashed cars! Check out /export.");
	// In about 6 or 7 minutes we need new wanted vehicles!
	return 1;
}

stock CExport__OnEnterCheckpoint( playerid )
{
	if(GetPlayerVirtualWorld(playerid) == 0)
	{
	    // Not even in a vehicle, :<
		if( !IsPlayerInAnyVehicle( playerid ) )
		{
			SendClientMessage( playerid, COLOR_ORANGE, "You need to be in a vehicle to export vehicles! To" );
			SendClientMessage( playerid, COLOR_ORANGE, "see which vehicles are wanted, see /export!" );
		}
		else
   		{
			// Check if he's in the right vehicle
			new playerVehicleID = GetPlayerVehicleID( playerid );
			new bProperVehicle = 0;
			new iPlayerReward;
			new iTempVar = 0;

			// Loop through all the wanted vehicles, check if the models are the same
			for (new i = 0; i < 3; i++)
			{
				if (GetVehicleModel( playerVehicleID ) == wantedVehicle[ i ])
				{
				    // Vehicle found! Save it
				    bProperVehicle = wantedVehicle[ i ];
				    iTempVar = i;
					break;
				}
			}

			// Check if it's not the GTA Vehicle
			if(playerVehicleID  == WantedCar)
			{
				SendClientMessage(playerid, COLOR_ORANGE, "You can't export impound vehicles!");
			}

			// He's in the correct vehicle
			if( bProperVehicle > 0 )
			{
			    // Check the vehicles health
				new Float:fHealth;
				GetVehicleHealth((GetPlayerVehicleID(playerid)), fHealth);

				// Get the vehicle name
				new name[36];
				set( name, VehicleNames[ ( bProperVehicle - 400 ) ] );


				// What is he trying to sell us here?!
				if(fHealth <= 370)
				{
					SendClientMessage(playerid, Red, "Sorry, we don't accept trashed vehicles.");
					return 1;
				}

				// Do we still need one of those?
				if(amountWantedVehicle[iTempVar] == 0)
				{
				    new string[128];
				    format(string, sizeof(string), "Sorry, we don't need a %s any more! Check /export for vehicles we still need.", name);
				    SendClientMessage(playerid, Red, string);
				    return 1;
				}

				// Respawn his old vehicle
				SetVehicleToRespawn( playerVehicleID );
				// Calculate the reward :o
				iPlayerReward = floatround(playerVehicleID * fHealth * 0.0314 * 3 * 10);

				// Decrease the amount of wanted vehicles of that type (only if it's above 0)
				if(amountWantedVehicle[iTempVar] != 0)
			    {
					amountWantedVehicle[iTempVar]--;
				}

				new string[128];
				// Zamg, still in good shape
				if(fHealth >= 800)
				{
					format( string, sizeof( string ), "Thanks for exporting a %s! Here is your $%d.", name, iPlayerReward );
					SendClientMessage( playerid, COLOR_ORANGE, string );
				}
				// Ohwell, still fixable
				else
				{
					format(string, sizeof(string), "Thanks for exporting a %s! However, since the vehicle isn't in perfect",name);
					SendClientMessage(playerid, COLOR_BROWN, string);
					format(string, sizeof(string), "condition, you only received $%d for it.", iPlayerReward);
					SendClientMessage(playerid, COLOR_BROWN, string);
				}

				//playerVehExp[ playerid ]++;

				// Give him his money
				GivePlayerMoney(playerid, iPlayerReward);
				//format( string, sizeof( string ), "You have already exported %d vehicles!", playerVehExp[ playerid ] );
				//SendClientMessage( playerid, COLOR_ORANGE, string );
				//CAchieve::Export(playerid, playerVehExp[playerid]);

				// Inform the crew
				format( string, sizeof( string ), ""COL_EXPORT"%s (ID:%d) has exported a %s, and earned $%d.", pName(playerid), playerid, name, iPlayerReward );
				MessageToAdmins(White, string);

				if(amountWantedVehicle[0] + amountWantedVehicle[1] + amountWantedVehicle[2] == 0)
				{
					CExport__NewWantedVehicle();
				}
			}
			else
			{
				// Wrong vehicle
				SendClientMessage( playerid, COLOR_ORANGE, "Sorry, we're currently not accepting this vehicle." );
				SendClientMessage( playerid, COLOR_ORANGE, "Check out /export for vehicles we accept." );
			}
		}
	}
	// Finally.. most annoying function ever edited. Stupid buffer overflows.
	return 1;
}

stock CExport__OnCommand(playerid)
{
	new szMessage[ 256 ];
	SendClientMessage( playerid, COLOR_YELLOW, "The following vehicles are currently wanted:" );
	format( szMessage, sizeof( szMessage ), "The%s", "" );
	for (new i = 0; i < 3; i++)
	{
		if (wantedVehicle[ i ] < 400 || wantedVehicle[ i ] > 610) continue;
		format (szMessage, sizeof( szMessage ), "%s %s (%d needed),", szMessage, VehicleNames[ ( wantedVehicle[ i ] - 400 ) ], amountWantedVehicle[ i ]);
	}

	format( szMessage, sizeof( szMessage ), "%s which can be exported at the export point, in the South of Las Venturas.", szMessage );
	SendClientMessage( playerid, COLOR_WHITE, szMessage );
	SendClientMessage(playerid,COLOR_WHITE,"The more vehicle damage there is, the less the vehicle is worth!");
	return 1;
}

stock CExport__EnterVehicle(playerid)
{
	for (new i = 0; i < 3; i++)
 	{
 		if(GetVehicleModel(GetPlayerVehicleID(playerid)) == wantedVehicle[i] && GetPlayerVehicleID(playerid) != WantedCar)
 		{
 		    if(amountWantedVehicle[i] != 0)
 		    {
				SendClientMessage(playerid,COLOR_PINK,""COL_EXPORT"Export: "COL_WHITE"This vehicle can be exported at the red checkpoint on your radar. Check out /export for more information.");
				//SetPlayerCheckpoint(playerid, 2287.8167, 551.0581, 10.8812, 4.0);
				//g_InExportVeh[playerid] = true;
			}
		}
	}
	return 1;
}


forward StartFuckingGame();
public StartFuckingGame()
{
	new random1 = random(sizeof(StolenCars)); new random2 = random(sizeof(Positions)); new car; new str[254];
	car = CreateVehicle(StolenCars[random1][0], Positions[random2][0], Positions[random2][1], Positions[random2][2], Positions[random2][3], random(126), random(126), -1);
	WantedCar = car;
	WantedGameOn = 1;
	for(new i=0; i<MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
	    	SetPlayerMapIcon(i, 6, Positions[random2][0],Positions[random2][1],Positions[random2][2], 55, MAPICON_GLOBAL);
		}
	}

    LOL = SetTimer("YourTooLate", 450000, false);
    format(str,sizeof(str),""COL_LIGHTBLUE"DVLA: "COL_WHITE"The impound has had a vehicle stolen and is willing to pay $%d to whoever retrieves it!", CASH_MONET);
    SendClientMessageToAll(DAYTONA_YELLOW, str);
    format(str,sizeof(str), "The %s was last seen in %s somewhere around %s", GetVehicleName(car), GetVehicleCity(car), GetVehicleZone(car));
    SendClientMessageToAll(DAYTONA_YELLOW, str);
    return 1;
}

forward EndFuckingGame(playerid);
public EndFuckingGame(playerid)
{
    DestroyVehicle(WantedCar);
    Gamecar[playerid] = INVALID_PLAYER_ID;
    WantedCar = INVALID_VEHICLE_ID;
    WantedGameOn = 0;
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
        	RemovePlayerMapIcon(i, 6);
		}
	}
	KillTimer(LOL);
    SetTimer("StartFuckingGame", 900000, false);
    return 1;
}

forward YourTooLate(playerid);
public YourTooLate(playerid)
{
	if(Gamecar[playerid] == INVALID_PLAYER_ID)
	{
	    SendClientMessageToAll(DAYTONA_YELLOW,""COL_LIGHTBLUE"DVLA: "COL_WHITE"The impound reward is no longer offered, they found it themselves!");
	}
	else
	{
        SendClientMessageToAll(DAYTONA_YELLOW,""COL_LIGHTBLUE"DVLA: The impound vehicle is no longer wanted, it took too long to deliver!");
        RemovePlayerFromVehicle(WantedCar);
	}
	EndFuckingGame(playerid);
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid)
{
	for(new x=0; x<MAX_PLAYERS; x++)
	{
	    if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
		{
	        TogglePlayerSpectating(x, 1);
	        PlayerSpectateVehicle(x, vehicleid);
	        PlayerInfo[x][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
		}
	}
    return 1;
}
//==============================================================================
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	switch(newstate)
	{
		case PLAYER_STATE_ONFOOT:
		{
			switch(oldstate)
			{
				case PLAYER_STATE_DRIVER: OnPlayerExitVehicle(playerid,255);
				case PLAYER_STATE_PASSENGER: OnPlayerExitVehicle(playerid,255);
			}
		}
	}
    if(newstate == PLAYER_STATE_DRIVER)
	{
		if(PlayerInfo[playerid][Licence] == 0)
		{
			SendClientMessage(playerid,red,"Error: You don't have the vehicle licence!");
			RemovePlayerFromVehicle(playerid);
		}
		new PlayerNa[24], Float:X, Float:Y, Float:Z;
        GetPlayerName(playerid, PlayerNa, sizeof(PlayerNa));
        new prvVehicle = GetPlayerVehicleID(playerid);
        if(prvVehicle == JeromeOwns)
        {
            if(strcmp(PlayerNa,"Jerome",true))
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, red, "This car is reserved for Jerome.");
            }
            else
            {
                new hour, minuten, second;
                gettime(hour,minuten,second);
                if(hour >= 12 && hour < 19)
                {
                	SendClientMessage(playerid, JEROME, "* Good afternoon, Jerome!");
				}
				else if(hour >= 19 && hour < 0)
				{
				    SendClientMessage(playerid, JEROME, "* Good evening, Jerome!"); // Add random messages here soon ;D
				}
				else if(hour >= 0 && hour < 7)
				{
				    SendClientMessage(playerid,JEROME, "* Hello, Jerome! Late night, is it?");
				}
			}
        }
        CExport__EnterVehicle(playerid); // Check if it's an export vehicle.
		if(prvVehicle == WantedCar && WantedGameOn == 1)
		{
		    GetVehiclePos(WantedCar, X, Y, Z);
			SetPlayerCheckpoint(playerid,2131.2141,-1147.5479,24.1365,7.0);
			SetVehicleParamsForPlayer(WantedCar,playerid,0,0);
			SendClientMessage(playerid,red,"*** The cars GPS shows a red checkpoint, see it? Get there with no damage!");
/*			for(new i=0; i<MAX_PLAYERS; i++)
			{
			    if(IsPlayerConnected(i) && Gamecar[i] != i)
			    {
					SetPlayerMapIcon(56,i, X, Y, Z, 55, 0);
					DisablePlayerCheckpoint(i);
				}
			}   */
			WantedIconTimer = SetTimer("WantedIcon", 700, 1);
			Gamecar[playerid] = playerid;
		}
		if(prvVehicle == aVehicle[0])
		{
		    if(PlayerInfo[playerid][Level] < 3 || Vallow[playerid] == 0)
			{
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid,red,"** This vehicle is for Administrators only!");
			} else return SendClientMessage(playerid,MANAGEMENT,"** Welcome to the Administration Tank!");
	    }
    	if(prvVehicle == aVehicle[1])
		{
		    if(PlayerInfo[playerid][Level] < 3)
			{
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid,red,"** This vehicle is reserved for Administrators only!");
			} else return SendClientMessage(playerid,MANAGEMENT,"** Welcome to the Reserved Administration Tank!");
	    }
    	if(prvVehicle == aVehicle[2])
		{
		    if(PlayerInfo[playerid][Level] < 3)
			{
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid,red,"** This vehicle is reserved for Administrators only!");
			} else return SendClientMessage(playerid,MANAGEMENT,"** Welcome to the Reserved Administration Patriot!");
	    }
        if(prvVehicle == aVehicle[3])
		{
           if(PlayerInfo[playerid][Level] < 3 || Vallow[playerid] == 0)
		   {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid,red,"** This vehicle is for Administrators only!");
			} else return SendClientMessage(playerid,MANAGEMENT,"** Welcome to the Administration Hunter!");
	    }
        if(prvVehicle == aVehicle[4])
		{
	        if(PlayerInfo[playerid][Level] < 3 || Vallow[playerid] == 0)
			{
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid,red,"** This vehicle is for Administrators only!");
			} else return SendClientMessage(playerid,MANAGEMENT,"** Welcome to the Administration Hydra!");
	    }
        if(prvVehicle == aVehicle[5])
		{
	        if(PlayerInfo[playerid][Level] < 3 || Vallow[playerid] == 0)
			{
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid,red,"** This vehicle is for Administrators only!");
			} else return SendClientMessage(playerid,MANAGEMENT,"** Welcome to the Administration Hydra!");
	    }
        if(prvVehicle == aVehicle[6])
		{
	        if(PlayerInfo[playerid][Level] < 2 || Vallow[playerid] == 0)
			{
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid,red,"** This vehicle is for Moderators only!");
			} else return SendClientMessage(playerid,MANAGEMENT,"** Welcome to the Moderators Patriot!");
	    }
	    if(prvVehicle == aVehicle[7])
		{
	        if(PlayerInfo[playerid][Level] < 2 || Vallow[playerid] == 0)
			{
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid,red,"** This vehicle is for Moderators only!");
			} else return SendClientMessage(playerid,MANAGEMENT,"** Welcome to the Moderators Tropic!");
	    }
	    if(prvVehicle == aVehicle[8] || prvVehicle == aVehicle[9] || prvVehicle == aVehicle[9] || prvVehicle == aVehicle[11] || prvVehicle == aVehicle[12] || prvVehicle == aVehicle[13] || prvVehicle == aVehicle[14] || prvVehicle == aVehicle[15] || prvVehicle == aVehicle[16] || prvVehicle == aVehicle[17])
		{
	        if(PlayerInfo[playerid][Level] < 3 || Vallow[playerid] == 0)
			{
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid,red,"** This vehicle is for Administrators only!");
			} else return SendClientMessage(playerid,MANAGEMENT,"** Welcome to the Administrators Jetmax!");
	    }
	    // VIP
		for(new i=0; i < 9; i++)
		{
	    	if(prvVehicle == VIPVehicle[i] && PlayerInfo[playerid][Level] < 1)
	    	{
     		   RemovePlayerFromVehicle(playerid);
     		   SendClientMessage(playerid, red, "This vehicle is for V.I.P's only. See /donate for information.");
			}
			else if(prvVehicle == VIPVehicle[i] && PlayerInfo[playerid][Level] >= 1)
			{
			    SendClientMessage(playerid, MANAGEMENT, "Welcome to one of the many V.I.P vehicles!");
			}
		}
	}
	if(newstate == PLAYER_STATE_ONFOOT && oldstate == PLAYER_STATE_DRIVER)
	{
	    if(vObject[playerid] != -1 && IsValidDynamicObject(vObject[playerid]))
	    {
	        DestroyDynamicObject(vObject[playerid]);
	        vObject[playerid] = -1;
	        SendClientMessage(playerid, MANAGEMENT, "Your vehicle object has been destroyed because you left your vehicle.");
		}
	}
	return 1;
}

forward LoadAdminCars();
public LoadAdminCars()
{
    aVehicle[0] = CreateVehicle(432,270.8577,2458.0222,16.4983,1.3725,0,7,AV_RESPAWN_TIME);
    aVehicle[1] = CreateVehicle(432,1254.2434,-44.4575,1000.6858,0.9202,0,7,AV_RESPAWN_TIME); LinkVehicleToInterior(aVehicle[1],18);
	aVehicle[2] = CreateVehicle(470,1287.8367,-43.6260,1000.6702,268.3552,0,7,AV_RESPAWN_TIME); LinkVehicleToInterior(aVehicle[2],18);
    aVehicle[3] = CreateVehicle(425,349.6490,2541.6345,19.6012,2.5503,0,7,AV_RESPAWN_TIME);
	aVehicle[4] = CreateVehicle(520,290.6448,2537.7976,17.5499,178.2983,0,0,AV_RESPAWN_TIME);
	aVehicle[5] = CreateVehicle(520,290.7686,2537.5833,17.5511,178.4832,0,0,AV_RESPAWN_TIME);
	aVehicle[6] = CreateVehicle(470,389.9050,2543.0244,16.5331,181.1388,0,0,AV_RESPAWN_TIME);
	aVehicle[7] = CreateVehicle(454,757.0896,-2892.4243,0.4062,280.9887,0,0, AV_RESPAWN_TIME); SetVehicleVirtualWorld(aVehicle[7],311287); // admin tropic
	aVehicle[8] = CreateVehicle(493,823.7709,-2856.3308,-0.7064,358.4241,36,13, AV_RESPAWN_TIME); SetVehicleVirtualWorld(aVehicle[8], 311287); // admin jetmax
	aVehicle[9] = CreateVehicle(493,737.3873,-2795.3796,0.3474,118.5903,36,18, AV_RESPAWN_TIME); SetVehicleVirtualWorld(aVehicle[9], 311287);// admin jetmax 2
	aVehicle[10] = CreateVehicle(564,406.1805,2542.6250,16.5304,180.3395, 0, 0, AV_RESPAWN_TIME); // The mini tank yall
	aVehicle[11] = CreateVehicle(481,-6190.4346,1741.0742,1.6752,165.4342,0,0,AV_RESPAWN_TIME); SetVehicleVirtualWorld(aVehicle[11],311287);// myland bmx
	aVehicle[12] = CreateVehicle(468,-6192.4287,1741.0082,1.8153,179.0643,0,1,AV_RESPAWN_TIME); SetVehicleVirtualWorld(aVehicle[12],311287);// myland sanchez
	aVehicle[13] = CreateVehicle(409,-6177.4365,1711.3977,2.0337,179.3629,0,0,AV_RESPAWN_TIME); SetVehicleVirtualWorld(aVehicle[13],311287);// myland stretch
	aVehicle[14] = CreateVehicle(518,-6185.8501,1739.6749,1.8175,180.8401,0,0,AV_RESPAWN_TIME); SetVehicleVirtualWorld(aVehicle[14],311287);// myland buc
	aVehicle[15] = CreateVehicle(425,-6033.4551,1595.3706,37.9157,228.3240,43,0,AV_RESPAWN_TIME); SetVehicleVirtualWorld(aVehicle[15],311287);// myland hunter
	aVehicle[16] = CreateVehicle(487,-5996.5156,1724.2240,5.6201,356.5728,0,0,AV_RESPAWN_TIME); SetVehicleVirtualWorld(aVehicle[16],311287);// myland maverick innit
	aVehicle[17] = CreateVehicle(571,-6194.4531,1741.4343,1.4306,179.0246,0,0,AV_RESPAWN_TIME); SetVehicleVirtualWorld(aVehicle[17],311287);// myland kart
}

forward ResetAdminCars();
public ResetAdminCars()
{
	for(new i=0; i < 11; i++)
 	{
  		DestroyVehicle(aVehicle[i]);
  	}
	LoadAdminCars();
}

forward LoadVIPVehicles();
public LoadVIPVehicles()
{
	VIPVehicle[0] = CreateVehicle(481,1802.7677,-1295.5513,12.9709,13.5526,0,0,AV_RESPAWN_TIME);
	VIPVehicle[1] = CreateVehicle(481,1805.8409,-1293.7972,13.0642,19.5903,0,0,AV_RESPAWN_TIME);
	VIPVehicle[2] = CreateVehicle(481,1808.2634,-1291.3387,13.1449,26.4665,0,0,AV_RESPAWN_TIME);
	VIPVehicle[3] = CreateVehicle(481,1811.7850,-1288.8195,13.1259,29.1207,0,0,AV_RESPAWN_TIME);
	VIPVehicle[4] = CreateVehicle(481,1813.6671,-1285.9890,13.1142,34.9721,0,0,AV_RESPAWN_TIME);
	VIPVehicle[5] = CreateVehicle(481,1816.0217,-1284.5211,13.1263,28.7555,0,0,AV_RESPAWN_TIME);
	VIPVehicle[6] = CreateVehicle(447,1782.7092,-1302.6304,131.7462,93.7961,75,2,AV_RESPAWN_TIME);
	VIPVehicle[7] = CreateVehicle(447,1825.1683,-1278.7472,131.7447,357.3960,75,2,AV_RESPAWN_TIME);
	VIPVehicle[8] = CreateVehicle(447,1823.1953,-1309.7247,131.7460,180.1269,75,2,AV_RESPAWN_TIME);
}

forward ResetVIPVehicles();
public ResetVIPVehicles()
{
	for(new v=0; v < 9; v++)
	{
	    DestroyVehicle(VIPVehicle[v]);
	}
	LoadVIPVehicles();
}

//==============================================================================
public OnPlayerExitVehicle(playerid, vehicleid)
{
	if(PlayerInfo[playerid][DoorsLocked] == 1) SetVehicleParamsForPlayerEx(GetPlayerVehicleID(playerid),playerid,false,false);
    if(vehicleid == WantedCar) DisablePlayerCheckpoint(playerid);
	#if defined ENABLE_SPEC
	for(new x=0; x<MAX_PLAYERS; x++)
	{
    	if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid && PlayerInfo[x][SpecType] == ADMIN_SPEC_TYPE_VEHICLE) {
        	TogglePlayerSpectating(x, 1);
	        PlayerSpectatePlayer(x, playerid);
    	    PlayerInfo[x][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
		}
	}
	#endif
	/*
	if(vehicleid == WantedCar && Gamecar[playerid] == playerid)
	{
	    Gamecar[playerid] = INVALID_PLAYER_ID;
	}
 	*/
 	if(vehicleid == WantedCar && WantedGameOn == 1)
 	{
  		new Float:X, Float:Y, Float:Z;
	    GetVehiclePos(WantedCar, X, Y, Z);
 		KillTimer(WantedIconTimer);
   		for(new i=0; i < MAX_PLAYERS; i++)
     	{
     	    if(IsPlayerConnected(i))
     	    {
     			SetPlayerMapIcon(i, 6, X, Y, Z, 55, MAPICON_GLOBAL);
     			//SetPlayerCheckpoint(playerid, X, Y, Z, 7.0);
			}
		}
		Gamecar[playerid] = INVALID_PLAYER_ID;
		return 1;
	}
	return 1;
}

//============================ Jerome's 1337 Textdraw Funky-shun ============================
forward TextDrawForAdmins(playerid, Text:text);
public TextDrawForAdmins(playerid, Text:text)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) == 1) if(PlayerInfo[i][Level] >= 3) TextDrawShowForPlayer(playerid, Text:text);
	}
	return 1;
} // SHITTY FUCKING WANK CRAP. Edit: kworks :D I win

forward HideTextDrawForAdmin(playerid);
public HideTextDrawForAdmin(playerid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) == 1) if(PlayerInfo[i][Level] >= 3) TextDrawHideForPlayer(playerid, test);
	}
	return 1;
}
//==============================================================================
/*#if defined ENABLE_SPEC

stock StartSpectate(playerid, specplayerid)
{
	for(new x=0; x<MAX_PLAYERS; x++) {
	    if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid) {
	       AdvanceSpectate(x);
		}
	}
	SetPlayerInterior(playerid,GetPlayerInterior(specplayerid));
	TogglePlayerSpectating(playerid, 1);

	if(IsPlayerInAnyVehicle(specplayerid)) {
		PlayerSpectateVehicle(playerid, GetPlayerVehicleID(specplayerid));
		PlayerInfo[playerid][SpecID] = specplayerid;
		PlayerInfo[playerid][SpecType] = ADMIN_SPEC_TYPE_VEHICLE;
	}
	else {
		PlayerSpectatePlayer(playerid, specplayerid);
		PlayerInfo[playerid][SpecID] = specplayerid;
		PlayerInfo[playerid][SpecType] = ADMIN_SPEC_TYPE_PLAYER;
	}
	new string[100], Float:hp, Float:ar;
	GetPlayerName(specplayerid,string,sizeof(string));
	GetPlayerHealth(specplayerid, hp);	GetPlayerArmour(specplayerid, ar);
	format(string,sizeof(string),"~n~~n~~n~~n~~n~~n~~n~~n~~w~%s - id:%d~n~< sprint - jump >~n~hp:%0.1f ar:%0.1f $%d", string,specplayerid,hp,ar,GetPlayerMoney(specplayerid) );
	GameTextForPlayer(playerid,string,25000,3);
	return 1;
}

stock StopSpectate(playerid)
{
	TogglePlayerSpectating(playerid, 0);
	PlayerInfo[playerid][SpecID] = INVALID_PLAYER_ID;
	PlayerInfo[playerid][SpecType] = ADMIN_SPEC_TYPE_NONE;
	GameTextForPlayer(playerid,"~n~~n~~n~~w~Spectate mode ended",1000,3);
	return 1;
}

stock AdvanceSpectate(playerid)
{
    if(ConnectedPlayers() == 2) { StopSpectate(playerid); return 1; }
	if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && PlayerInfo[playerid][SpecID] != INVALID_PLAYER_ID)
	{
	    for(new x=PlayerInfo[playerid][SpecID]+1; x<=MAX_PLAYERS; x++)
		{
	    	if(x == MAX_PLAYERS) x = 0;
	        if(IsPlayerConnected(x) && x != playerid)
			{
				if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
				{
					continue;
				}
				else
				{
					StartSpectate(playerid, x);
					break;
				}
			}
		}
	}
	return 1;
}

stock ReverseSpectate(playerid)
{
    if(ConnectedPlayers() == 2) { StopSpectate(playerid); return 1; }
	if(GetPlayerState(playerid) == PLAYER_STATE_SPECTATING && PlayerInfo[playerid][SpecID] != INVALID_PLAYER_ID)
	{
	    for(new x=PlayerInfo[playerid][SpecID]-1; x>=0; x--)
		{
	    	if(x == 0) x = MAX_PLAYERS;
	        if(IsPlayerConnected(x) && x != playerid)
			{
				if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] != INVALID_PLAYER_ID || (GetPlayerState(x) != 1 && GetPlayerState(x) != 2 && GetPlayerState(x) != 3))
				{
					continue;
				}
				else
				{
					StartSpectate(playerid, x);
					break;
				}
			}
		}
	}
	return 1;
}
#endif
*/
//-------------------------------------------
forward PosAfterSpec(playerid);
public PosAfterSpec(playerid)
{
	SetPlayerRandomSpawn(playerid);
}
//==============================================================================

// OnGameModeInit
forward CreateNewbieSpawn();
public CreateNewbieSpawn()
{
	Rule1 = CreateDynamicPickup(1239, 23, 2518.8569,-1458.5496,23.9750, -1, -1, -1);
	Rule1_3D = Create3DTextLabel("Don't cheat!", Red, 2518.8569,-1458.5496,23.9750+0.5, 40.0, 0, 1);
	Rule2 = CreateDynamicPickup(1239, 23, 2521.4219,-1458.5574,23.9589, -1, -1, -1);
	Rule2_3D = Create3DTextLabel("No Flaming!", Red, 2521.4219,-1458.5574,23.9589+0.5, 40.0, 0, 1);
	Rule3 = CreateDynamicPickup(1239, 23, 2524.2227,-1458.5502,23.9459, -1, -1, -1);
	Rule3_3D = Create3DTextLabel("Need help?", Red, 2524.2227,-1458.5502,23.9459+0.5, 40.0, 0, 1);
	Rule4 = CreateDynamicPickup(1239, 23, 2527.3538,-1458.5424,23.9378, -1, -1, -1);
	Rule4_3D = Create3DTextLabel("Getting started!", Red, 2527.3538,-1458.5424,23.9378+0.5, 40.0, 0, 1);

	Newb_Wep1 = CreateDynamicPickup(350, 15, 2515.5842,-1456.6869,23.9671, -1, -1, -1);
	Newb_Wep2 = CreateDynamicPickup(352, 15, 2511.6116,-1456.3907,23.9709, -1, -1, -1);
	return 1;
}
// OnGameModeExit
forward Delete3DTextLabels();
public Delete3DTextLabels()
{
	Delete3DTextLabel(Rule1_3D);
	Delete3DTextLabel(Rule2_3D);
	Delete3DTextLabel(Rule3_3D);
	Delete3DTextLabel(Rule4_3D);
	Delete3DTextLabel(Prop3D);
	Delete3DTextLabel(Dyna_3D);
	return;
}

forward CarSpawner(playerid,model);
public CarSpawner(playerid,model)
{
	if(IsPlayerInAnyVehicle(playerid)) SendClientMessage(playerid, red, "You already have a car!");
 	else
	{
    	new Float:x, Float:y, Float:z, Float:angle;
	 	GetPlayerPos(playerid, x, y, z);
	 	GetPlayerFacingAngle(playerid, angle);
		if(PlayerInfo[playerid][PlayerDynCar] != -1) CarDeleter(PlayerInfo[playerid][PlayerDynCar]);
	    new vehicleid=CreateVehicle(model, x, y, z, angle, -1, -1, -1);
		PutPlayerInVehicle(playerid, vehicleid, 0);
		SetVehicleVirtualWorld(vehicleid, GetPlayerVirtualWorld(playerid));
		LinkVehicleToInterior(vehicleid, GetPlayerInterior(playerid));
		ChangeVehicleColor(vehicleid,0,7);
        PlayerInfo[playerid][PlayerDynCar] = vehicleid;
	}
	return 1;
}

forward CarDeleter(vehicleid);
public CarDeleter(vehicleid)
{
    for(new i=0;i<MAX_PLAYERS;i++)
	{
        //new Float:X,Float:Y,Float:Z;
        if(IsPlayerConnected(i))
        {
    		if(IsPlayerInVehicle(i, vehicleid))
			{
    	    	RemovePlayerFromVehicle(i);
    	    	//GetPlayerPos(i,X,Y,Z);
        		//SetPlayerPos(i,X,Y+3,Z);
	    	}
		}
	}
    SetTimerEx("VehRes",1500,0,"i",vehicleid);
}

forward VehRes(vehicleid);
public VehRes(vehicleid)
{
    DestroyVehicle(vehicleid);
}

public OnVehicleSpawn(vehicleid)
{
	for(new i=0;i<MAX_PLAYERS;i++)
	{
        if(vehicleid==PlayerInfo[i][PlayerDynCar])
		{
		    CarDeleter(vehicleid);
	        PlayerInfo[i][PlayerDynCar] = -1;
        }
	}
	//We don't want cars respawning locked :-)
/*	new engine, lights, alarm, doors, bonnet, boot, objective;
 	GetVehicleParamsEx(GetPlayerVehicleID(playerid), engine, lights, alarm, doors, bonnet, boot, objective);
	if(doors == 1)
	{
 		SetVehicleParamsEx(vehicleid, engine, lights, alarm, 0, bonnet, doors, objective);
	} */
 	if(vehicleid == JeromeOwns)
  	{
		SetVehiclePlate(JeromeOwns, "{FF0066}J3R0M3");
   		AddVehicleComponent(JeromeOwns, 1010);
		AddVehicleComponent(JeromeOwns, 1087);
		AddVehicleComponent(JeromeOwns,1078);
	}
	return 1;
}
//==============================================================================
forward TuneLCar(VehicleID);
public TuneLCar(VehicleID)
{
	ChangeVehicleColor(VehicleID,0,0);
	AddVehicleComponent(VehicleID, 1010);  AddVehicleComponent(VehicleID, 1087);
}

//==============================================================================
//==============================================================================

public OnRconCommand(cmd[])
{
	if( strlen(cmd) > 50 || strlen(cmd) == 1 ) return print("Invalid command length (exceeding 50 characters)");

	if(strcmp(cmd, "lsx", true)==0)
	{
		print("Rcon Commands");
		print("info, aka, pm, asay, ann, uconfig, chat");
		return true;
	}

	if(strcmp(cmd, "info", true)==0)
	{
    new TotalVehicles = CreateVehicle(411, 0, 0, 0, 0, 0, 0, 1000);    DestroyVehicle(TotalVehicles);
	new numo = CreateDynamicObject(1245,0,0,1000,0,0,0);	DestroyObject(numo);
	new nump = CreateDynamicPickup(371,2,0,0,1000,-1);	DestroyPickup(nump);
	new gz = GangZoneCreate(3,3,5,5);	GangZoneDestroy(gz);

	new model[250], nummodel;
	for(new i=1;i<TotalVehicles;i++) model[GetVehicleModel(i)-400]++;
	for(new i=0;i<250;i++)
	{
		if(model[i]!=0)
		{
			nummodel++;
		}
	}

	new string[128];
	print(" ===========================================================================");
	printf("                           Server Info:");
	format(string,sizeof(string),"[ Players Connected: %d || Maximum Players: %d ] [Ratio %0.2f ]",ConnectedPlayers(),GetMaxPlayers(),Float:ConnectedPlayers() / Float:GetMaxPlayers() );
	printf(string);
	format(string,sizeof(string),"[ Vehicles: %d || Models %d || Players In Vehicle: %d ]",TotalVehicles-1,nummodel, InVehCount() );
	printf(string);
	format(string,sizeof(string),"[ InCar %d  ||  OnBike %d ]",InCarCount(),OnBikeCount() );
	printf(string);
	format(string,sizeof(string),"[ Objects: %d || Pickups %d  || Gangzones %d]",numo-1, nump, gz);
	printf(string);
	format(string,sizeof(string),"[ Players In Jail %d || Players Frozen %d ]",JailedPlayers(),FrozenPlayers() );
    printf(string);
    format(string,sizeof(string),"[ Admins online %d ]",AdminCount() );
    printf(string);
	print(" ===========================================================================");
	return true;
	}

	if(strcmp(cmd, "uconfig", true)==0)
	{
		UpdateConfig();
		print("Configuration Successfully Updated");
		return true;
	}

	if(!strcmp(cmd, "aka", .length = 3))
	{
	    new arg_1 = argpos(cmd), targetid = strval(cmd[arg_1]);

    	if ( !cmd[arg_1] || cmd[arg_1] < '0' || cmd[arg_1] > '9' || targetid > MAX_PLAYERS || targetid < 0)
	        print("Usage: aka <playerid>");
	    else if ( !IsPlayerConnected(targetid) ) print("This player is not connected!");
    	else
	    {
			new tmp3[50], playername[MAX_PLAYER_NAME];
	  		GetPlayerIp(targetid,tmp3,50);
			GetPlayerName(targetid, playername, sizeof(playername));
			printf("AKA: [%s id:%d] [%s] %s", playername, targetid, tmp3, dini_Get("lsx/config/aka.txt",tmp3) );
    	}
	    return true;
	}

	return 0;
}

//==============================================================================
//  Menus - Including spawn wepz menu, because Vichuzz fucking sux at coding -.-
//==============================================================================

#if defined USE_MENUS
public OnPlayerSelectedMenuRow(playerid, row)
{
  	new Menu:Current = GetPlayerMenu(playerid);
  	new string[128];
  	new cash = GetPlayerMoney(playerid);

	for(new menu; menu<TotalMenus; menu++)
	{

		if(Current == CCTVMenu[menu])
		{
		    if(MenuType[PlayerMenu[playerid]] == 1)
		    {
		        if(row == 11)
		        {
		            ShowMenuForPlayer(CCTVMenu[menu+1], playerid);
		            TogglePlayerControllable(playerid, 0);
		            PlayerMenu[playerid] = (menu+1);
				}
				else
				{
				    if(PlayerMenu[playerid] == 0)
				    {
				    	SetPlayerToCCTVCamera(playerid, row);
				    	PlayerMenu[playerid] = -1;
					}
					else
					{
					    SetPlayerToCCTVCamera(playerid, ((PlayerMenu[playerid]*11)+row));
					    PlayerMenu[playerid] = -1;
					}
				}
			}
			else
			{
			    if(PlayerMenu[playerid] == 0)
			    {
			    	SetPlayerToCCTVCamera(playerid, row);
			    	PlayerMenu[playerid] = -1;
				}
				else
				{
				    SetPlayerToCCTVCamera(playerid, ((PlayerMenu[playerid]*11)+row));
				    PlayerMenu[playerid] = -1;
				}
			}
		}
	}

	if(Current == Revenge) {
		TogglePlayerControllable(playerid,false);
		switch(row) {
			case 0: { new cash2 = GetPlayerMoney(KillerID[playerid]); GivePlayerMoney(playerid,cash2); GivePlayerMoney(KillerID[playerid],0-cash2); KillerID[playerid] = INVALID_PLAYER_ID; SendClientMessage(KillerID[playerid],red,"*** Your money was stolen as punishment for a drive-by!"); }
            case 1: { JailPlayer(KillerID[playerid]); SetTimerEx("JailRelease",60000,false,"i",KillerID[playerid]); KillerID[playerid] = INVALID_PLAYER_ID; SendClientMessage(KillerID[playerid],red,"*** You have been jailed as punishment for a drive-by!"); }
            case 2: { new Float:x, Float:y, Float:z; GetPlayerPos(KillerID[playerid],x,y,z); SetPlayerHealth(KillerID[playerid],50); CreateExplosion(x,y,z,5,10); KillerID[playerid] = INVALID_PLAYER_ID; SendClientMessage(KillerID[playerid],red,"*** You have been exploded as punishment for a drive-by!"); }
			case 3: { ResetPlayerWeapons(KillerID[playerid]); KillerID[playerid] = INVALID_PLAYER_ID; SendClientMessage(KillerID[playerid],red,"*** Your weapons have been taken as punishment for a drive-by!"); }
			case 4: { new str[254]; format(str,sizeof(str),"* %s gives %s a blowjob", KillerID[playerid], playerid); SendClientMessageToAll(GetPlayerColor(KillerID[playerid]),str); }
		}
        return 1;
	}
	if(Current == weaponmenu) {
        TogglePlayerControllable(playerid,false);
        switch(row) {
            case 0:ShowMenuForPlayer(Grenades, playerid);
            case 1:ShowMenuForPlayer(sawnoff, playerid);
            case 2:ShowMenuForPlayer(combat, playerid);
            case 3:ShowMenuForPlayer(uzi, playerid);
            case 4:ShowMenuForPlayer(tec9, playerid);
            case 5:ShowMenuForPlayer(mp5, playerid);
            case 6:ShowMenuForPlayer(sniper, playerid);
            case 7:
            {
       	    if(cash >= 20000) {
                GivePlayerSpawnWeapon(playerid, 46, 1);
                GivePlayerMoney(playerid,-20000);
                SendClientMessage(playerid,MANAGEMENT,"You bought a parachute which has been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
		    } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
		    }
            case 8:ShowMenuForPlayer(m4, playerid);
            case 9:ShowMenuForPlayer(ak47, playerid);
            case 10:ShowMenuForPlayer(deagle, playerid);
            case 11:
            {
       	    if(cash >= 150000) {
                SetPlayerArmour(playerid,100.0);
				SpawnArmourBought[playerid] = 1;
                GivePlayerMoney(playerid,-150000);
                SendClientMessage(playerid,MANAGEMENT,"You bought spawn armour!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
		    }
        }
	    return 1;
	}
    if(Current == Grenades) {
        TogglePlayerControllable(playerid,false);
        switch(row) {
    	    case 0:
     	    {
       	    if(cash >= 15000) {
                GivePlayerSpawnWeapon(playerid, 16, 15);
                GivePlayerMoney(playerid,-15000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 1x grenades which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
			} else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
		    }
            case 1:
     	    {
       	    if(cash >= 30000) {
                GivePlayerSpawnWeapon(playerid, 16, 30);
                GivePlayerMoney(playerid,-30000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 2x grenades which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
			} else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 2:
     	    {
       	    if(cash >= 75000) {
                GivePlayerSpawnWeapon(playerid, 16, 45);
                GivePlayerMoney(playerid,-45000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 5x grenades which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
			} else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 3:
		    {
       	    if(cash >= 100000) {
                GivePlayerSpawnWeapon(playerid, 16, 75);
                GivePlayerMoney(playerid,-75000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 10x grenades which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
		    } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 4:
	        {
       	    if(cash >= 300000) {
                GivePlayerSpawnWeapon(playerid, 16, 140);
                GivePlayerMoney(playerid,-100000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 20x grenades which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
			} else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 5:
     	    {
       	    if(cash >= 750000) {
                GivePlayerSpawnWeapon(playerid, 16, 280);
                GivePlayerMoney(playerid,-300000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 50x grenades which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
			} else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 6:
     	    {
       	    if(cash >= 1000000) {
                GivePlayerSpawnWeapon(playerid, 16, 1000);
                GivePlayerMoney(playerid,-750000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 100x grenades which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
		    } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 7:
     	    {
       	    if(cash >= 1500000) {
                GivePlayerWeapon(playerid, 16, 10000);
                GivePlayerMoney(playerid,-1500000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 150x Grenades which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
			} else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
        }
        return 1;
    }
    if(Current == sawnoff) {
        TogglePlayerControllable(playerid,false);
        switch(row) {
    	    case 0:
     	    {
       	    if(cash >= 15000) {
                GivePlayerSpawnWeapon(playerid, 26, 30);
                GivePlayerMoney(playerid,-15000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 1x Sawnoff which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 1:
     	    {
       	    if(cash >= 30000) {
                GivePlayerSpawnWeapon(playerid, 26, 60);
                GivePlayerMoney(playerid,-30000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 2x Sawnoff which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 2:
     	    {
       	    if(cash >= 75000) {
                GivePlayerSpawnWeapon(playerid, 26, 120);
                GivePlayerMoney(playerid,-75000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 5x Sawnoff which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 3:
     	    {
       	    if(cash >= 100000) {
                GivePlayerSpawnWeapon(playerid, 26, 240);
                GivePlayerMoney(playerid,-100000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 10x Sawnoff which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 4:
     	    {
       	    if(cash >= 300000) {
                GivePlayerSpawnWeapon(playerid, 26, 480);
                GivePlayerMoney(playerid,-300000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 20x Sawnoff which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 5:
     	    {
       	    if(cash >= 750000) {
                GivePlayerSpawnWeapon(playerid, 26, 960);
                GivePlayerMoney(playerid,-750000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 50x Sawnoff which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 6:
     	    {
       	    if(cash >= 1000000) {
                GivePlayerSpawnWeapon(playerid, 26, 1920);
                GivePlayerMoney(playerid,-1000000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 100x Sawnoff which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 7:
     	    {
       	    if(cash >= 1500000) {
                GivePlayerSpawnWeapon(playerid, 26, 3840);
                GivePlayerMoney(playerid,-1500000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 150x Sawnoff which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
        }
        return 1;
    }
    if(Current == combat) {
        TogglePlayerControllable(playerid,false);
        switch(row){
    	    case 0:
     	    {
       	    if(cash >= 15000) {
                GivePlayerSpawnWeapon(playerid, 27, 30);
                GivePlayerMoney(playerid,-15000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 1x Combat Shotgun which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 1:
     	    {
       	    if(cash >= 30000) {
                GivePlayerSpawnWeapon(playerid, 27, 60);
                GivePlayerMoney(playerid,-75000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 2x Combat Shotgun which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 2:
			{
       	    if(cash >= 75000) {
                GivePlayerSpawnWeapon(playerid, 27, 120);
                GivePlayerMoney(playerid,-75000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 5x Combat Shotgun which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 3:
     	    {
       	    if(cash >= 100000) {
                GivePlayerSpawnWeapon(playerid, 27, 240);
                GivePlayerMoney(playerid,-100000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 10x Combat Shotgun which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 4:
     	    {
       	    if(cash >= 300000) {
                GivePlayerSpawnWeapon(playerid, 27, 480);
                GivePlayerMoney(playerid,-300000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 20x Combat Shotgun which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 5:
     	    {
       	    if(cash >= 750000) {
                GivePlayerSpawnWeapon(playerid, 27, 960);
                GivePlayerMoney(playerid,-750000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 50x Combat Shotgun which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 6:
     	    {
       	    if(cash >= 1000000) {
                GivePlayerSpawnWeapon(playerid, 27, 1920);
                GivePlayerMoney(playerid,-1000000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 100x Combat Shotgun which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 7:
     	    {
       	    if(cash >= 1500000) {
                GivePlayerSpawnWeapon(playerid, 27, 3840);
                GivePlayerMoney(playerid,-1500000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 150x Combat Shotgun which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
        }
        return 1;
    }
    if(Current == uzi) {
        TogglePlayerControllable(playerid,false);
	    switch(row) {
    	    case 0:
     	    {
       	    if(cash >= 15000) {
                GivePlayerSpawnWeapon(playerid, 28, 30);
                GivePlayerMoney(playerid,-15000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 1x Uzi which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 1:
     	    {
       	    if(cash >= 30000) {
                GivePlayerSpawnWeapon(playerid, 28, 60);
                GivePlayerMoney(playerid,-30000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 2x Uzi which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 2:
      	    {
       	    if(cash >= 75000) {
                GivePlayerSpawnWeapon(playerid, 28, 120);
                GivePlayerMoney(playerid,-75000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 5x Uzi which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 3:
     	    {
       	    if(cash >= 100000) {
                GivePlayerSpawnWeapon(playerid, 28, 240);
                GivePlayerMoney(playerid,-100000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 10x Uzi which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 4:
     	    {
       	    if(cash >= 300000) {
                GivePlayerSpawnWeapon(playerid, 28, 480);
                GivePlayerMoney(playerid,-300000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 20x Uzi which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 5:
     	    {
       	    if(cash >= 750000) {
                GivePlayerSpawnWeapon(playerid, 28, 960);
                GivePlayerMoney(playerid,-750000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 50x Uzi which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 6:
     	    {
       	    if(cash >= 1000000) {
                GivePlayerSpawnWeapon(playerid, 28, 1920);
                GivePlayerMoney(playerid,-1000000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 100x Uzi which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 7:
     	    {
       	    if(cash >= 1500000) {
                GivePlayerSpawnWeapon(playerid, 28, 3840);
                GivePlayerMoney(playerid,-1500000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 150x Uzi which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
        }
        return 1;
    }
    if(Current == tec9) {
        TogglePlayerControllable(playerid,false);
	    switch(row) {
            case 0:
     	    {
       	    if(cash >= 15000) {
                GivePlayerSpawnWeapon(playerid, 32, 15);
                GivePlayerMoney(playerid,-15000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 1x Tec 9 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 1:
     	    {
       	    if(cash >= 30000) {
                GivePlayerSpawnWeapon(playerid, 32, 60);
                GivePlayerMoney(playerid,-30000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 2x Tec 9 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 2:
     	    {
       	    if(cash >= 75000) {
                GivePlayerSpawnWeapon(playerid, 32, 120);
                GivePlayerMoney(playerid,-75000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 5x Tec 9 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 3:
     	    {
       	    if(cash >= 100000) {
                GivePlayerSpawnWeapon(playerid, 32, 240);
                GivePlayerMoney(playerid,-100000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 10x Tec 9 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 4:
     	    {
       	    if(cash >= 300000) {
                GivePlayerSpawnWeapon(playerid, 32, 480);
                GivePlayerMoney(playerid,-300000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 20x Tec 9 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 5:
     	    {
       	    if(cash >= 750000) {
                GivePlayerSpawnWeapon(playerid, 32, 960);
                GivePlayerMoney(playerid,-750000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 50x Tec 9 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 6:
     	    {
       	    if(cash >= 1000000) {
                GivePlayerSpawnWeapon(playerid, 32, 1920);
                GivePlayerMoney(playerid,-1000000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 100x Tec 9 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 7:
     	    {
       	    if(cash >= 1500000) {
                GivePlayerSpawnWeapon(playerid, 32, 3840);
                GivePlayerMoney(playerid,-1500000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 150x Tec 9 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
        }
        return 1;
    }
    if(Current == mp5) {
        TogglePlayerControllable(playerid,false);
        switch(row) {
    	    case 0:
     	    {
       	    if(cash >= 15000) {
                GivePlayerSpawnWeapon(playerid, 29, 30);
                GivePlayerMoney(playerid,-15000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 1x MP5 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 1:
     	    {
       	    if(cash >= 30000) {
                GivePlayerSpawnWeapon(playerid, 29, 60);
                GivePlayerMoney(playerid,-30000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 2x MP5 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 2:
     	    {
       	    if(cash >= 75000) {
                GivePlayerSpawnWeapon(playerid, 29, 120);
                GivePlayerMoney(playerid,-75000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 5x MP5 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 3:
     	    {
       	    if(cash >= 100000) {
                GivePlayerSpawnWeapon(playerid, 29, 240);
                GivePlayerMoney(playerid,-100000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 10x MP5 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 4:
     	    {
       	    if(cash >= 300000) {
                GivePlayerSpawnWeapon(playerid, 29, 480);
                GivePlayerMoney(playerid,-300000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 20x MP5 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 5:
     	    {
       	    if(cash >= 750000) {
                GivePlayerSpawnWeapon(playerid, 29, 960);
                GivePlayerMoney(playerid,-750000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 50x MP5 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 6:
     	    {
       	    if(cash >= 1000000) {
                GivePlayerSpawnWeapon(playerid, 29, 1920);
                GivePlayerMoney(playerid,-1000000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 100x MP5 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 7:
     	    {
       	    if(cash >= 1500000) {
                GivePlayerSpawnWeapon(playerid, 29, 3840);
                GivePlayerMoney(playerid,-1500000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 150x MP5 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
        }
        return 1;
    }
    if(Current == sniper) {
        TogglePlayerControllable(playerid,false);
        switch(row) {
    	    case 0:
     	    {
       	    if(cash >= 15000) {
                GivePlayerSpawnWeapon(playerid, 34, 15);
                GivePlayerMoney(playerid,-15000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 1x Sniper Rifle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 1:
     	    {
       	    if(cash >= 30000) {
                GivePlayerSpawnWeapon(playerid, 34, 60);
                GivePlayerMoney(playerid,-30000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 2x Sniper Rifle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 2:
     	    {
       	    if(cash >= 75000) {
                GivePlayerSpawnWeapon(playerid, 34, 120);
                GivePlayerMoney(playerid,-75000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 5x Sniper Rifle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 3:
     	    {
       	    if(cash >= 100000) {
                GivePlayerSpawnWeapon(playerid, 34, 240);
                GivePlayerMoney(playerid,-100000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 10x Sniper Rifle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 4:
     	    {
       	    if(cash >= 300000) {
                GivePlayerSpawnWeapon(playerid, 34, 480);
                GivePlayerMoney(playerid,-300000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 20x Sniper Rifle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 5:
     	    {
       	    if(cash >= 750000) {
                GivePlayerSpawnWeapon(playerid, 34, 960);
                GivePlayerMoney(playerid,-750000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 50x Sniper Rifle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 6:
     	    {
       	    if(cash >= 1000000) {
                GivePlayerSpawnWeapon(playerid, 34, 1920);
                GivePlayerMoney(playerid,-1000000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 100x Sniper Rifle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 7:
     	    {
       	    if(cash >= 1500000) {
                GivePlayerSpawnWeapon(playerid, 34, 3840);
                GivePlayerMoney(playerid,-1500000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 150x Sniper Rifle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
        }
        return 1;
    }
    if(Current == m4) {
        TogglePlayerControllable(playerid,false);
        switch(row) {
    	    case 0:
     	    {
       	    if(cash >= 15000) {
                GivePlayerSpawnWeapon(playerid, 31, 30);
                GivePlayerMoney(playerid,-15000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 1x M4 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 1:
     	    {
       	    if(cash >= 30000) {
                GivePlayerSpawnWeapon(playerid, 31, 60);
                GivePlayerMoney(playerid,-30000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 2x M4 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 2:
     	    {
       	    if(cash >= 75000) {
                GivePlayerSpawnWeapon(playerid, 31, 120);
                GivePlayerMoney(playerid,-75000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 5x M4 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 3:
     	    {
       	    if(cash >= 100000) {
                GivePlayerSpawnWeapon(playerid, 31, 240);
                GivePlayerMoney(playerid,-100000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 10x M4 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 4:
     	    {
       	    if(cash >= 300000) {
                GivePlayerSpawnWeapon(playerid, 31, 480);
                GivePlayerMoney(playerid,-300000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 20x M4 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 5:
 	        {
       	    if(cash >= 750000) {
                GivePlayerSpawnWeapon(playerid, 31, 960);
                GivePlayerMoney(playerid,-750000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 50x M4 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 6:
     	    {
       	    if(cash >= 1000000) {
                GivePlayerSpawnWeapon(playerid, 31, 1920);
                GivePlayerMoney(playerid,-1000000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 100x M4 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 7:
     	    {
       	    if(cash >= 1500000) {
                GivePlayerSpawnWeapon(playerid, 31, 3840);
                GivePlayerMoney(playerid,-1500000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 150x M4 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
        }
        return 1;
    }
    if(Current == ak47) {
        TogglePlayerControllable(playerid,false);
        switch(row) {
    	    case 0:
     	    {
       	    if(cash >= 15000) {
                GivePlayerSpawnWeapon(playerid, 30, 30);
                GivePlayerMoney(playerid,-15000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 1x AK-47 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 1:
     	    {
       	    if(cash >= 30000) {
                GivePlayerSpawnWeapon(playerid, 30, 60);
                GivePlayerMoney(playerid,-30000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 2x AK-47 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 2:
      	    {
       	    if(cash >= 75000) {
                GivePlayerSpawnWeapon(playerid, 30, 120);
                GivePlayerMoney(playerid,-75000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 5x AK-47 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 3:
     	    {
  	        if(cash >= 100000) {
                GivePlayerSpawnWeapon(playerid, 30, 240);
                GivePlayerMoney(playerid,-100000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 10x AK-47 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 4:
     	    {
  	        if(cash >= 300000) {
                GivePlayerSpawnWeapon(playerid, 30, 480);
                GivePlayerMoney(playerid,-300000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 20x AK-47 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 5:
     	    {
       	    if(cash >= 750000) {
                GivePlayerSpawnWeapon(playerid, 30, 960);
                GivePlayerMoney(playerid,-750000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 50x AK-47 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 6:
     	    {
       	    if(cash >= 1000000) {
                GivePlayerSpawnWeapon(playerid, 30, 1920);
                GivePlayerMoney(playerid,-1000000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 100x AK-47 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 7:
     	    {
       	    if(cash >= 1500000) {
                GivePlayerSpawnWeapon(playerid, 30, 3840);
                GivePlayerMoney(playerid,-1500000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 150x AK-47 which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
        }
        return 1;
    }
    if(Current == deagle) {
        TogglePlayerControllable(playerid,false);
        switch(row) {
    	    case 0:
     	    {
       	    if(cash >= 15000) {
                GivePlayerSpawnWeapon(playerid, 24, 30);
                GivePlayerMoney(playerid,-75000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 1x Desert Eagle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 1:
     	    {
       	    if(cash >= 30000) {
                GivePlayerSpawnWeapon(playerid, 24, 60);
                GivePlayerMoney(playerid,-30000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 2x Desert Eagle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 2:
     	    {
       	    if(cash >= 75000) {
                GivePlayerSpawnWeapon(playerid, 24, 120);
                GivePlayerMoney(playerid,-75000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 5x Desert Eagle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 3:
     	    {
       	    if(cash >= 100000) {
                GivePlayerSpawnWeapon(playerid, 24, 240);
                GivePlayerMoney(playerid,-100000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 10x Desert Eagle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 4:
     	    {
            if(cash >= 300000) {
                GivePlayerSpawnWeapon(playerid, 24, 480);
                GivePlayerMoney(playerid,-300000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 20x Desert Eagle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 5:
     	    {
       	    if(cash >= 750000) {
                GivePlayerSpawnWeapon(playerid, 24, 960);
                GivePlayerMoney(playerid,-750000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 50x Desert Eagle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 6:
     	    {
       	    if(cash >= 1000000) {
                GivePlayerSpawnWeapon(playerid, 24, 1920);
                GivePlayerMoney(playerid,-1000000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 100x Desert Eagle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
            case 7:
     	    {
       	    if(cash >= 1500000) {
                GivePlayerSpawnWeapon(playerid, 24, 3840);
                GivePlayerMoney(playerid,-1500000);
                SendClientMessage(playerid,MANAGEMENT,"You bought 150x Desert Eagle which have been added to your inventory!");
                ShowMenuForPlayer(weaponmenu,playerid);
            } else { SendClientMessage(playerid,red,fuckoff); ShowMenuForPlayer(weaponmenu,playerid); }
            }
        }
        return 1;
    }
    if(Current == LMainMenu) {
        switch(row)
		{
 			case 0:
			{
				if(PlayerInfo[playerid][Level] >= 4) ShowMenuForPlayer(AdminEnable,playerid);
   				else {
   					SendClientMessage(playerid,MAD_WHITE,"SERVER:Unknown Command");
	   				TogglePlayerControllable(playerid,true);
   				}
			}
			case 1:
			{
				if(PlayerInfo[playerid][Level] >= 4) ShowMenuForPlayer(AdminDisable,playerid);
   				else {
   					SendClientMessage(playerid,MAD_WHITE,"SERVER:Unknown Command");
	   				TogglePlayerControllable(playerid,true);
   				}
			}
 			case 2: ShowMenuForPlayer(LWeather,playerid);
 			case 3: ShowMenuForPlayer(LTime,playerid);
   			case 4:	ShowMenuForPlayer(LVehicles,playerid);
			case 5:	ShowMenuForPlayer(LCars,playerid);
 			case 6:
            {
				if(PlayerInfo[playerid][Level] >= 2)
				{
        			if(IsPlayerInAnyVehicle(playerid))
					{
						new LVehicleID = GetPlayerVehicleID(playerid), LModel = GetVehicleModel(LVehicleID);
					    switch(LModel)
						{
							case 448,461,462,463,468,471,509,510,521,522,523,581,586,449:
							{
								SendClientMessage(playerid,red,"ERROR: You can not tune this vehicle");  TogglePlayerControllable(playerid,true);
								return 1;
							}
						}
					    TogglePlayerControllable(playerid,false);	ShowMenuForPlayer(LTuneMenu,playerid);
			        }
					else { SendClientMessage(playerid,red,"ERROR: You do not have a vehicle to tune"); TogglePlayerControllable(playerid,true); }
		    	} else { SendClientMessage(playerid,MAD_WHITE,"SERVER:Unknown Command"); TogglePlayerControllable(playerid,true);	}
			}
  			case 7:
	  		{
	  			if(PlayerInfo[playerid][Level] >= 3) ShowMenuForPlayer(XWeapons,playerid);
			  	else SendClientMessage(playerid,MAD_WHITE,"SERVER:Unknown Command"); TogglePlayerControllable(playerid,true);
			}
			case 8:	 ShowMenuForPlayer(LTele,playerid);
			case 9:
			{
				new Menu:Currentxmenu = GetPlayerMenu(playerid);
	    		HideMenuForPlayer(Currentxmenu,playerid);   TogglePlayerControllable(playerid,true);
		    }
		}
		return 1;
	}//-------------------------------------------------------------------------
	if(Current == AdminEnable) {
		new adminname[MAX_PLAYER_NAME], file[128]; GetPlayerName(playerid, adminname, sizeof(adminname));
		format(file,sizeof(file),"lsx/config/Config.ini");
		switch(row){
			case 0: { ServerInfo[AntiSwear] = 1; dini_IntSet(file,"AntiSwear",1); format(string,sizeof(string),"Administrator %s has enabled antiswear",adminname); SendClientMessageToAll(blue,string);	}
			case 1: { ServerInfo[NameKick] = 1; dini_IntSet(file,"NameKick",1); format(string,sizeof(string),"Administrator %s has enabled namekick",adminname); SendClientMessageToAll(blue,string);	}
			case 2:	{ ServerInfo[AntiSpam] = 1; dini_IntSet(file,"AntiSpam",1); format(string,sizeof(string),"Administrator %s has enabled antispam",adminname); SendClientMessageToAll(blue,string);	}
			case 3:	{ ServerInfo[MaxPing] = 1000; dini_IntSet(file,"MaxPing",1000); format(string,sizeof(string),"Administrator %s has enabled ping kick",adminname); SendClientMessageToAll(blue,string);	}
			case 4:	{ ServerInfo[ReadCmds] = 1; dini_IntSet(file,"ReadCmds",1); format(string,sizeof(string),"Administrator %s has enabled reading commands",adminname); MessageToAdmins(green,string);	}
			case 5:	{ ServerInfo[ReadPMs] = 1; dini_IntSet(file,"ReadPMs",1); format(string,sizeof(string),"Administrator %s has enabled reading pms",adminname); MessageToAdmins(green,string); }
			case 6:	{ ServerInfo[NoCaps] = 0; dini_IntSet(file,"NoCaps",0); format(string,sizeof(string),"Administrator %s has allowed captial letters in chat",adminname); SendClientMessageToAll(blue,string); }
			case 7:	{ ServerInfo[ConnectMessages] = 1; dini_IntSet(file,"ConnectMessages",1); format(string,sizeof(string),"Administrator %s has enabled connect messages",adminname); SendClientMessageToAll(blue,string); }
			case 8:	{ ServerInfo[AdminCmdMsg] = 1; dini_IntSet(file,"AdminCmdMessages",1); format(string,sizeof(string),"Administrator %s has enabled admin command messages",adminname); MessageToAdmins(green,string); }
			case 9:	{ ServerInfo[AutoLogin] = 1; dini_IntSet(file,"AutoLogin",1); format(string,sizeof(string),"Administrator %s has enabled auto login",adminname); SendClientMessageToAll(blue,string); }
            case 10: return ChangeMenu(playerid,Current,LMainMenu);
		}
		return TogglePlayerControllable(playerid,true);
	}//------------------------------------------------------------------------
	if(Current == AdminDisable) {
		new adminname[MAX_PLAYER_NAME], file[128]; GetPlayerName(playerid, adminname, sizeof(adminname));
		format(file,sizeof(file),"lsx/config/Config.ini");
		switch(row){
			case 0: { ServerInfo[AntiSwear] = 0; dini_IntSet(file,"AntiSwear",0); format(string,sizeof(string),"Administrator %s has disabled antiswear",adminname); SendClientMessageToAll(blue,string);	}
			case 1: { ServerInfo[NameKick] = 0; dini_IntSet(file,"NameKick",0); format(string,sizeof(string),"Administrator %s has disabled namekick",adminname); SendClientMessageToAll(blue,string);	}
			case 2:	{ ServerInfo[AntiSpam] = 0; dini_IntSet(file,"AntiSpam",0); format(string,sizeof(string),"Administrator %s has disabled antispam",adminname); SendClientMessageToAll(blue,string);	}
			case 3:	{ ServerInfo[MaxPing] = 0; dini_IntSet(file,"MaxPing",0); format(string,sizeof(string),"Administrator %s has disabled ping kick",adminname); SendClientMessageToAll(blue,string);	}
			case 4:	{ ServerInfo[ReadCmds] = 0; dini_IntSet(file,"ReadCmds",0); format(string,sizeof(string),"Administrator %s has disabled reading commands",adminname); MessageToAdmins(green,string);	}
			case 5:	{ ServerInfo[ReadPMs] = 0; dini_IntSet(file,"ReadPMs",0); format(string,sizeof(string),"Administrator %s has disabled reading pms",adminname); MessageToAdmins(green,string); }
			case 6:	{ ServerInfo[NoCaps] = 1; dini_IntSet(file,"NoCaps",1); format(string,sizeof(string),"Administrator %s has prevented captial letters in chat",adminname); SendClientMessageToAll(blue,string); }
			case 7:	{ ServerInfo[ConnectMessages] = 0; dini_IntSet(file,"ConnectMessages",0); format(string,sizeof(string),"Administrator %s has disabled connect messages",adminname); SendClientMessageToAll(blue,string); }
			case 8:	{ ServerInfo[AdminCmdMsg] = 0; dini_IntSet(file,"AdminCmdMessages",0); format(string,sizeof(string),"Administrator %s has disabled admin command messages",adminname); MessageToAdmins(green,string); }
			case 9:	{ ServerInfo[AutoLogin] = 0; dini_IntSet(file,"AutoLogin",0); format(string,sizeof(string),"Administrator %s has disabled auto login",adminname); SendClientMessageToAll(blue,string); }
            case 10: return ChangeMenu(playerid,Current,LMainMenu);
		}
		return TogglePlayerControllable(playerid,true);
	}//-------------------------------------------------------------------------
	if(Current==LVehicles){
		switch(row){
			case 0: ChangeMenu(playerid,Current,twodoor);
			case 1: ChangeMenu(playerid,Current,fourdoor);
			case 2: ChangeMenu(playerid,Current,fastcar);
			case 3: ChangeMenu(playerid,Current,Othercars);
			case 4: ChangeMenu(playerid,Current,bikes);
			case 5: ChangeMenu(playerid,Current,boats);
			case 6: ChangeMenu(playerid,Current,planes);
			case 7: ChangeMenu(playerid,Current,helicopters);
			case 8: return ChangeMenu(playerid,Current,LMainMenu);
		}
		return 1;
	}
	if(Current==twodoor){
		new vehid;
		switch(row){
			case 0: vehid = 533;
			case 1: vehid = 439;
			case 2: vehid = 555;
			case 3: vehid = 422;
			case 4: vehid = 554;
			case 5: vehid = 575;
			case 6: vehid = 536;
			case 7: vehid = 535;
			case 8: vehid = 576;
			case 9: vehid = 401;
			case 10: vehid = 526;
			case 11: return ChangeMenu(playerid,Current,LVehicles);
		}
		return SelectCar(playerid,vehid,Current);
	}
	if(Current==fourdoor){
		new vehid;
		switch(row){
			case 0: vehid = 404;
			case 1: vehid = 566;
			case 2: vehid = 412;
			case 3: vehid = 445;
			case 4: vehid = 507;
			case 5: vehid = 466;
			case 6: vehid = 546;
			case 7: vehid = 511;
			case 8: vehid = 467;
			case 9: vehid = 426;
			case 10: vehid = 405;
			case 11: return ChangeMenu(playerid,Current,LVehicles);
		}
		return SelectCar(playerid,vehid,Current);
	}
	if(Current==fastcar){
		new vehid;
		switch(row){
			case 0: vehid = 480;
			case 1: vehid = 402;
			case 2: vehid = 415;
			case 3: vehid = 587;
			case 4: vehid = 494;
			case 5: vehid = 411;
			case 6: vehid = 603;
			case 7: vehid = 506;
			case 8: vehid = 451;
			case 9: vehid = 477;
			case 10: vehid = 541;
			case 11: return ChangeMenu(playerid,Current,LVehicles);
		}
		return SelectCar(playerid,vehid,Current);
	}
	if(Current==Othercars){
		new vehid;
		switch(row){
			case 0: vehid = 556;
			case 1: vehid = 408;
			case 2: vehid = 431;
			case 3: vehid = 437;
			case 4: vehid = 427;
			case 5: vehid = 432;
			case 6: vehid = 601;
			case 7: vehid = 524;
			case 8: vehid = 455;
			case 9: vehid = 424;
			case 10: vehid = 573;
			case 11: return ChangeMenu(playerid,Current,LVehicles);
		}
		return SelectCar(playerid,vehid,Current);
	}
	if(Current==bikes){
		new vehid;
		switch(row){
			case 0: vehid = 581;
			case 1: vehid = 481;
			case 2: vehid = 462;
			case 3: vehid = 521;
			case 4: vehid = 463;
			case 5: vehid = 522;
			case 6: vehid = 461;
			case 7: vehid = 448;
			case 8: vehid = 471;
			case 9: vehid = 468;
			case 10: vehid = 586;
			case 11: return ChangeMenu(playerid,Current,LVehicles);
		}
		return SelectCar(playerid,vehid,Current);
	}
	if(Current==boats){
		new vehid;
		switch(row){
			case 0: vehid = 472;
			case 1: vehid = 473;
			case 2: vehid = 493;
			case 3: vehid = 595;
			case 4: vehid = 484;
			case 5: vehid = 430;
			case 6: vehid = 453;
			case 7: vehid = 452;
			case 8: vehid = 446;
			case 9: vehid = 454;
			case 10: return ChangeMenu(playerid,Current,LVehicles);
		}
		return SelectCar(playerid,vehid,Current);
	}
	if(Current==planes){
		new vehid;
		switch(row){
			case 0: vehid = 592;
			case 1: vehid = 577;
			case 2: vehid = 511;
			case 3: vehid = 512;
			case 4: vehid = 593;
			case 5: vehid = 520;
			case 6: vehid = 553;
			case 7: vehid = 476;
			case 8: vehid = 519;
			case 9: vehid = 460;
			case 10: vehid = 513;
			case 11: return ChangeMenu(playerid,Current,LVehicles);
		}
		return SelectCar(playerid,vehid,Current);
	}
	if(Current==helicopters){
		new vehid;
		switch(row){
			case 0: vehid = 548;
			case 1: vehid = 425;
			case 2: vehid = 417;
			case 3: vehid = 487;
			case 4: vehid = 488;
			case 5: vehid = 497;
			case 6: vehid = 563;
			case 7: vehid = 447;
			case 8: vehid = 469;
			case 9: return ChangeMenu(playerid,Current,LVehicles);
		}
		return SelectCar(playerid,vehid,Current);
	}

	if(Current==XWeapons){
		switch(row){
			case 0: { GivePlayerWeapon(playerid,24,500); }
			case 1: { GivePlayerWeapon(playerid,31,500); }
			case 2: { GivePlayerWeapon(playerid,26,500); }
			case 3: { GivePlayerWeapon(playerid,27,500); }
			case 4: { GivePlayerWeapon(playerid,28,500); }
			case 5: { GivePlayerWeapon(playerid,35,500); }
			case 6: { GivePlayerWeapon(playerid,38,1000); }
			case 7: { GivePlayerWeapon(playerid,34,500); }
			case 8: return ChangeMenu(playerid,Current,XWeaponsBig);
        	case 9: return ChangeMenu(playerid,Current,XWeaponsSmall);
        	case 10: return ChangeMenu(playerid,Current,XWeaponsMore);
        	case 11: return ChangeMenu(playerid,Current,LMainMenu);
		}
		return TogglePlayerControllable(playerid,true);
	}

	if(Current==XWeaponsBig){
		switch(row){
			case 0: { GivePlayerWeapon(playerid,25,500);  }
			case 1: { GivePlayerWeapon(playerid,30,500); }
			case 2: { GivePlayerWeapon(playerid,33,500); }
			case 3: { GivePlayerWeapon(playerid,36,500); }
			case 4: { GivePlayerWeapon(playerid,37,500); }
			case 5: { GivePlayerWeapon(playerid,29,500); }
			case 6: { GivePlayerWeapon(playerid,32,1000); }
			case 7: return ChangeMenu(playerid,Current,XWeapons);
		}
		return TogglePlayerControllable(playerid,true);
	}

	if(Current==XWeaponsSmall){
		switch(row){
			case 0: { GivePlayerWeapon(playerid,22,500); }//9mm
			case 1: { GivePlayerWeapon(playerid,23,500); }//s9
			case 2: { GivePlayerWeapon(playerid,18,500); }// MC
			case 3: { GivePlayerWeapon(playerid,42,500); }//FE
			case 4: { GivePlayerWeapon(playerid,41,500); }//spraycan
			case 5: { GivePlayerWeapon(playerid,16,500); }//grenade
			case 6: { GivePlayerWeapon(playerid,8,500); }//Katana
			case 7: { GivePlayerWeapon(playerid,9,1000); }//chainsaw
			case 8: return ChangeMenu(playerid,Current,XWeapons);
		}
		return TogglePlayerControllable(playerid,true);
	}

	if(Current==XWeaponsMore){
		switch(row){
			case 0: SetPlayerSpecialAction(playerid, 2);
			case 1: GivePlayerWeapon(playerid,4,500);
			case 2: GivePlayerWeapon(playerid,14,500);
			case 3: GivePlayerWeapon(playerid,43,500);
			case 4: GivePlayerWeapon(playerid,7,500);
			case 5: GivePlayerWeapon(playerid,5,500);
			case 6: GivePlayerWeapon(playerid,2,1000);
			case 7: MaxAmmo(playerid);
			case 8: return ChangeMenu(playerid,Current,XWeapons);
		}
		return TogglePlayerControllable(playerid,true);
	}

    if(Current == LTele)
	{
        switch(row)
		{
			case 0: ChangeMenu(playerid,Current,LasVenturasMenu);
			case 1: ChangeMenu(playerid,Current,LosSantosMenu);
			case 2: ChangeMenu(playerid,Current,SanFierroMenu);
			case 3: ChangeMenu(playerid,Current,DesertMenu);
			case 4: ChangeMenu(playerid,Current,FlintMenu);
			case 5: ChangeMenu(playerid,Current,MountChiliadMenu);
			case 6: ChangeMenu(playerid,Current,InteriorsMenu);
			case 7: return ChangeMenu(playerid,Current,LMainMenu);
		}
		return 1;
	}

    if(Current == LasVenturasMenu)
	{
        switch(row)
		{
			case 0: { SetPlayerPos(playerid,2037.0,1343.0,12.0); SetPlayerInterior(playerid,0); }// strip
			case 1: { SetPlayerPos(playerid,2163.0,1121.0,23); SetPlayerInterior(playerid,0); }// come a lot
			case 2: { SetPlayerPos(playerid,1688.0,1615.0,12.0); SetPlayerInterior(playerid,0); }// lv airport
			case 3: { SetPlayerPos(playerid,2503.0,2764.0,10.0); SetPlayerInterior(playerid,0); }// military fuel
			case 4: { SetPlayerPos(playerid,1418.0,2733.0,10.0); SetPlayerInterior(playerid,0); }// golf lv
			case 5: { SetPlayerPos(playerid,1377.0,2196.0,9.0); SetPlayerInterior(playerid,0); }// pitch match
			case 6: return ChangeMenu(playerid,Current,LTele);
		}
		return TogglePlayerControllable(playerid,true);
	}

    if(Current == LosSantosMenu)
	{
        switch(row)
		{
			case 0: { SetPlayerPos(playerid,2495.0,-1688.0,13.0); SetPlayerInterior(playerid,0); }// ganton
			case 1: { SetPlayerPos(playerid,1979.0,-2241.0,13.0); SetPlayerInterior(playerid,0); }// ls airport
			case 2: { SetPlayerPos(playerid,2744.0,-2435.0,15.0); SetPlayerInterior(playerid,0); }// docks
			case 3: { SetPlayerPos(playerid,1481.0,-1656.0,14.0); SetPlayerInterior(playerid,0); }// square
			case 4: { SetPlayerPos(playerid,1150.0,-2037.0,69.0); SetPlayerInterior(playerid,0); }// veradant bluffs
			case 5: { SetPlayerPos(playerid,425.0,-1815.0,6.0); SetPlayerInterior(playerid,0); }// santa beach
			case 6: { SetPlayerPos(playerid,1240.0,-744.0,95.0); SetPlayerInterior(playerid,0); }// mullholland
			case 7: { SetPlayerPos(playerid,679.0,-1070.0,49.0); SetPlayerInterior(playerid,0); }// richman
			case 8: return ChangeMenu(playerid,Current,LTele);
		}
		return TogglePlayerControllable(playerid,true);
	}

    if(Current == SanFierroMenu)
	{
        switch(row)
		{
			case 0: { SetPlayerPos(playerid,-1990.0,137.0,27.0); SetPlayerInterior(playerid,0); } // sf station
			case 1: { SetPlayerPos(playerid,-1528.0,-206.0,14.0); SetPlayerInterior(playerid,0); }// sf airport
			case 2: { SetPlayerPos(playerid,-2709.0,198.0,4.0); SetPlayerInterior(playerid,0); }// ocean flats
			case 3: { SetPlayerPos(playerid,-2738.0,-295.0,6.0); SetPlayerInterior(playerid,0); }// avispa country club
			case 4: { SetPlayerPos(playerid,-1457.0,465.0,7.0); SetPlayerInterior(playerid,0); }// easter basic docks
			case 5: { SetPlayerPos(playerid,-1853.0,1404.0,7.0); SetPlayerInterior(playerid,0); }// esplanadae north
			case 6: { SetPlayerPos(playerid,-2620.0,1373.0,7.0); SetPlayerInterior(playerid,0); }// battery point
			case 7: return ChangeMenu(playerid,Current,LTele);
		}
		return TogglePlayerControllable(playerid,true);
	}

    if(Current == DesertMenu)
	{
        switch(row)
		{
			case 0: { SetPlayerPos(playerid,416.0,2516.0,16.0); SetPlayerInterior(playerid,0); } // plane graveyard
			case 1: { SetPlayerPos(playerid,81.0,1920.0,17.0); SetPlayerInterior(playerid,0); }// area51
			case 2: { SetPlayerPos(playerid,-324.0,1516.0,75.0); SetPlayerInterior(playerid,0); }// big ear
			case 3: { SetPlayerPos(playerid,-640.0,2051.0,60.0); SetPlayerInterior(playerid,0); }// dam
			case 4: { SetPlayerPos(playerid,-766.0,1545.0,27.0); SetPlayerInterior(playerid,0); }// las barrancas
			case 5: { SetPlayerPos(playerid,-1514.0,2597.0,55.0); SetPlayerInterior(playerid,0); }// el qyebrados
			case 6: { SetPlayerPos(playerid,442.0,1427.0,9.0); SetPlayerInterior(playerid,0); }// actane springs
			case 7: return ChangeMenu(playerid,Current,LTele);
		}
		return TogglePlayerControllable(playerid,true);
	}

    if(Current == FlintMenu)
	{
        switch(row)
		{
			case 0: { SetPlayerPos(playerid,-849.0,-1940.0,13.0);  SetPlayerInterior(playerid,0); }// lake
			case 1: { SetPlayerPos(playerid,-1107.0,-1619.0,76.0);  SetPlayerInterior(playerid,0); }// leafy hollow
			case 2: { SetPlayerPos(playerid,-1049.0,-1199.0,128.0);  SetPlayerInterior(playerid,0); }// the farm
			case 3: { SetPlayerPos(playerid,-1655.0,-2219.0,32.0);  SetPlayerInterior(playerid,0); }// shady cabin
			case 4: { SetPlayerPos(playerid,-375.0,-1441.0,25.0); SetPlayerInterior(playerid,0); }// flint range
			case 5: { SetPlayerPos(playerid,-367.0,-1049.0,59.0); SetPlayerInterior(playerid,0); }// beacon hill
			case 6: { SetPlayerPos(playerid,-494.0,-555.0,25.0); SetPlayerInterior(playerid,0); }// fallen tree
			case 7: return ChangeMenu(playerid,Current,LTele);
		}
		return TogglePlayerControllable(playerid,true);
	}

    if(Current == MountChiliadMenu)
	{
        switch(row)
		{
			case 0: { SetPlayerPos(playerid,-2308.0,-1657.0,483.0);  SetPlayerInterior(playerid,0); }// chiliad jump
			case 1: { SetPlayerPos(playerid,-2331.0,-2180.0,35.0); SetPlayerInterior(playerid,0); }// bottom chiliad
			case 2: { SetPlayerPos(playerid,-2431.0,-1620.0,526.0);  SetPlayerInterior(playerid,0); }// highest point
			case 3: { SetPlayerPos(playerid,-2136.0,-1775.0,208.0);  SetPlayerInterior(playerid,0); }// chiliad path
			case 4: return ChangeMenu(playerid,Current,LTele);
		}
		return TogglePlayerControllable(playerid,true);
	}

    if(Current == InteriorsMenu)
	{
        switch(row)
		{
			case 0: {	SetPlayerPos(playerid,386.5259, 173.6381, 1008.3828);	SetPlayerInterior(playerid,3); }
			case 1: {	SetPlayerPos(playerid,288.4723, 170.0647, 1007.1794);	SetPlayerInterior(playerid,3); }
			case 2: {	SetPlayerPos(playerid,372.5565, -131.3607, 1001.4922);	SetPlayerInterior(playerid,5); }
			case 3: {	SetPlayerPos(playerid,-1129.8909, 1057.5424, 1346.4141);	SetPlayerInterior(playerid,10); }
			case 4: {	SetPlayerPos(playerid,2233.9363, 1711.8038, 1011.6312);	SetPlayerInterior(playerid,1); }
			case 5: {	SetPlayerPos(playerid,2536.5322, -1294.8425, 1044.125);	SetPlayerInterior(playerid,2); }
			case 6: {	SetPlayerPos(playerid,1267.8407, -776.9587, 1091.9063);	SetPlayerInterior(playerid,5); }
  			case 7: {	SetPlayerPos(playerid,-1421.5618, -663.8262, 1059.5569);	SetPlayerInterior(playerid,4); }
   			case 8: {	SetPlayerPos(playerid,-1401.067, 1265.3706, 1039.8672);	SetPlayerInterior(playerid,16); }
   			case 9: {	SetPlayerPos(playerid,285.8361, -39.0166, 1001.5156);	SetPlayerInterior(playerid,1); }
    		case 10: {	SetPlayerPos(playerid,1727.2853, -1642.9451, 20.2254);	SetPlayerInterior(playerid,18); }
			case 11: return ChangeMenu(playerid,Current,LTele);
		}
		return TogglePlayerControllable(playerid,true);
	}

    if(Current == LWeather)
	{
		new adminname[MAX_PLAYER_NAME]; GetPlayerName(playerid, adminname, sizeof(adminname));
        switch(row)
		{
			case 0:	{	SetWeather(5);	PlayerPlaySound(playerid,1057,0.0,0.0,0.0);	CMDMessageToAdmins(playerid,"SETWEATHER"); format(string,sizeof(string),"Administrator %s has changed the weather",adminname); SendClientMessageToAll(blue,string); }
   			case 1:	{	SetWeather(19); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); CMDMessageToAdmins(playerid,"SETWEATHER");	format(string,sizeof(string),"Administrator %s has changed the weather",adminname); SendClientMessageToAll(blue,string); }
			case 2:	{	SetWeather(8);  PlayerPlaySound(playerid,1057,0.0,0.0,0.0); CMDMessageToAdmins(playerid,"SETWEATHER");	format(string,sizeof(string),"Administrator %s has changed the weather",adminname); SendClientMessageToAll(blue,string); }
			case 3:	{	SetWeather(20);	PlayerPlaySound(playerid,1057,0.0,0.0,0.0); CMDMessageToAdmins(playerid,"SETWEATHER");	format(string,sizeof(string),"Administrator %s has changed the weather",adminname); SendClientMessageToAll(blue,string); }
			case 4:	{	SetWeather(9);  PlayerPlaySound(playerid,1057,0.0,0.0,0.0); CMDMessageToAdmins(playerid,"SETWEATHER");	format(string,sizeof(string),"Administrator %s has changed the weather",adminname); SendClientMessageToAll(blue,string); }
			case 5:	{	SetWeather(16); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); CMDMessageToAdmins(playerid,"SETWEATHER");	format(string,sizeof(string),"Administrator %s has changed the weather",adminname); SendClientMessageToAll(blue,string); }
			case 6:	{	SetWeather(45); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); CMDMessageToAdmins(playerid,"SETWEATHER");	format(string,sizeof(string),"Administrator %s has changed the weather",adminname); SendClientMessageToAll(blue,string); }
			case 7:	{	SetWeather(44); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); CMDMessageToAdmins(playerid,"SETWEATHER");	format(string,sizeof(string),"Administrator %s has changed the weather",adminname); SendClientMessageToAll(blue,string); }
			case 8:	{	SetWeather(22); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); CMDMessageToAdmins(playerid,"SETWEATHER");	format(string,sizeof(string),"Administrator %s has changed the weather",adminname); SendClientMessageToAll(blue,string); }
			case 9:	{	SetWeather(11); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); CMDMessageToAdmins(playerid,"SETWEATHER");	format(string,sizeof(string),"Administrator %s has changed the weather",adminname); SendClientMessageToAll(blue,string); }
			case 10: return ChangeMenu(playerid,Current,LMainMenu);
		}
		return TogglePlayerControllable(playerid,true);
	}

    if(Current == LTuneMenu)
	{
        switch(row)
		{
			case 0:	{	AddVehicleComponent(GetPlayerVehicleID(playerid),1010); PlayerPlaySound(playerid,1133,0.0,0.0,0.0);	SendClientMessage(playerid,blue,"Vehicle Component Added");	}
   			case 1:	{	AddVehicleComponent(GetPlayerVehicleID(playerid),1087); PlayerPlaySound(playerid,1133,0.0,0.0,0.0);	SendClientMessage(playerid,blue,"Vehicle Component Added"); }
			case 2:	{	AddVehicleComponent(GetPlayerVehicleID(playerid),1081); PlayerPlaySound(playerid,1133,0.0,0.0,0.0);	SendClientMessage(playerid,blue,"Vehicle Component Added");	}
			case 3: {	AddVehicleComponent(GetPlayerVehicleID(playerid),1078); PlayerPlaySound(playerid,1133,0.0,0.0,0.0);	SendClientMessage(playerid,blue,"Vehicle Component Added");	}
			case 4:	{	AddVehicleComponent(GetPlayerVehicleID(playerid),1098); PlayerPlaySound(playerid,1133,0.0,0.0,0.0);	SendClientMessage(playerid,blue,"Vehicle Component Added");	}
			case 5:	{	AddVehicleComponent(GetPlayerVehicleID(playerid),1074); PlayerPlaySound(playerid,1133,0.0,0.0,0.0);	SendClientMessage(playerid,blue,"Vehicle Component Added");	}
			case 6:	{	AddVehicleComponent(GetPlayerVehicleID(playerid),1082); PlayerPlaySound(playerid,1133,0.0,0.0,0.0);	SendClientMessage(playerid,blue,"Vehicle Component Added");	}
			case 7:	{	AddVehicleComponent(GetPlayerVehicleID(playerid),1085); PlayerPlaySound(playerid,1133,0.0,0.0,0.0);	SendClientMessage(playerid,blue,"Vehicle Component Added");	}
			case 8:	{	AddVehicleComponent(GetPlayerVehicleID(playerid),1025); PlayerPlaySound(playerid,1133,0.0,0.0,0.0);	SendClientMessage(playerid,blue,"Vehicle Component Added");	}
			case 9:	{	AddVehicleComponent(GetPlayerVehicleID(playerid),1077); PlayerPlaySound(playerid,1133,0.0,0.0,0.0);	SendClientMessage(playerid,blue,"Vehicle Component Added");	}
			case 10: return ChangeMenu(playerid,Current,PaintMenu);
			case 11: return ChangeMenu(playerid,Current,LMainMenu);
		}
		return TogglePlayerControllable(playerid,true);
	}

    if(Current == PaintMenu)
	{
        switch(row)
		{
			case 0:	{ ChangeVehiclePaintjob(GetPlayerVehicleID(playerid),0); PlayerPlaySound(playerid,1133,0.0,0.0,0.0); SendClientMessage(playerid,blue,"Vehicle Paint Changed To Paint Job 1"); }
			case 1:	{ ChangeVehiclePaintjob(GetPlayerVehicleID(playerid),1); PlayerPlaySound(playerid,1133,0.0,0.0,0.0); SendClientMessage(playerid,blue,"Vehicle Paint Changed To Paint Job 2"); }
			case 2:	{ ChangeVehiclePaintjob(GetPlayerVehicleID(playerid),2); PlayerPlaySound(playerid,1133,0.0,0.0,0.0); SendClientMessage(playerid,blue,"Vehicle Paint Changed To Paint Job 3"); }
			case 3:	{ ChangeVehiclePaintjob(GetPlayerVehicleID(playerid),3); PlayerPlaySound(playerid,1133,0.0,0.0,0.0); SendClientMessage(playerid,blue,"Vehicle Paint Changed To Paint Job 4"); }
			case 4:	{ ChangeVehiclePaintjob(GetPlayerVehicleID(playerid),4); PlayerPlaySound(playerid,1133,0.0,0.0,0.0); SendClientMessage(playerid,blue,"Vehicle Paint Changed To Paint Job 5"); }
			case 5:	{ ChangeVehicleColor(GetPlayerVehicleID(playerid),0,0); PlayerPlaySound(playerid,1133,0.0,0.0,0.0); SendClientMessage(playerid,blue,"Vehicle Paint Colour Changed To Black"); }
			case 6:	{ ChangeVehicleColor(GetPlayerVehicleID(playerid),1,1); PlayerPlaySound(playerid,1133,0.0,0.0,0.0); SendClientMessage(playerid,blue,"Vehicle Paint Colour Changed To White"); }
			case 7:	{ ChangeVehicleColor(GetPlayerVehicleID(playerid),79,158); PlayerPlaySound(playerid,1133,0.0,0.0,0.0); SendClientMessage(playerid,blue,"Vehicle Paint Colour Changed To Black"); }
			case 8:	{ ChangeVehicleColor(GetPlayerVehicleID(playerid),146,183); PlayerPlaySound(playerid,1133,0.0,0.0,0.0); SendClientMessage(playerid,blue,"Vehicle Paint Colour Changed To Black"); }
			case 9: return ChangeMenu(playerid,Current,LTuneMenu);
		}
		return TogglePlayerControllable(playerid,true);
	}

    if(Current == LTime)
	{
		new adminname[MAX_PLAYER_NAME]; GetPlayerName(playerid, adminname, sizeof(adminname));
        switch(row)
		{
			case 0:	{ for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) SetPlayerTime(i,7,0);	PlayerPlaySound(playerid,1057,0.0,0.0,0.0);	CMDMessageToAdmins(playerid,"LTIME MENU");	format(string,sizeof(string),"Administrator %s has changed the time",adminname); SendClientMessageToAll(blue,string); }
   			case 1:	{ for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) SetPlayerTime(i,12,0); PlayerPlaySound(playerid,1057,0.0,0.0,0.0); CMDMessageToAdmins(playerid,"LTIME MENU");	format(string,sizeof(string),"Administrator %s has changed the time",adminname); SendClientMessageToAll(blue,string); }
			case 2:	{ for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) SetPlayerTime(i,16,0);  PlayerPlaySound(playerid,1057,0.0,0.0,0.0); CMDMessageToAdmins(playerid,"LTIME MENU");	format(string,sizeof(string),"Administrator %s has changed the time",adminname); SendClientMessageToAll(blue,string); }
			case 3:	{ for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) SetPlayerTime(i,20,0);	PlayerPlaySound(playerid,1057,0.0,0.0,0.0); CMDMessageToAdmins(playerid,"LTIME MENU");	format(string,sizeof(string),"Administrator %s has changed the time",adminname); SendClientMessageToAll(blue,string); }
			case 4:	{ for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) SetPlayerTime(i,0,0);  PlayerPlaySound(playerid,1057,0.0,0.0,0.0); CMDMessageToAdmins(playerid,"LTIME MENU");	format(string,sizeof(string),"Administrator %s has changed the time",adminname); SendClientMessageToAll(blue,string); }
			case 5: return ChangeMenu(playerid,Current,LMainMenu);
		}
		return TogglePlayerControllable(playerid,true);
	}

    if(Current == LCars)
	{
		new vehid;
        switch(row) {
			case 0: vehid = 451;//Turismo
			case 1: vehid = 568;//Bandito
			case 2: vehid = 539;//Vortex
			case 3: vehid = 522;//nrg
			case 4: vehid = 601;//s.w.a.t
			case 5: vehid = 425; //hunter
			case 6: vehid = 493;//jetmax
			case 7: vehid = 432;//rhino
			case 8: vehid = 444; //mt
			case 9: vehid = 447; //sea sparrow
			case 10: return ChangeMenu(playerid,Current,LCars2);
			case 11: return ChangeMenu(playerid,Current,LMainMenu);
		}
		return SelectCar(playerid,vehid,Current);
	}

    if(Current == LCars2)
	{
		new vehid;
        switch(row) {
			case 0: vehid = 406;// dumper
			case 1: vehid = 564; //rc tank
			case 2: vehid = 441;//RC Bandit
			case 3: vehid = 464;// rc baron
			case 4: vehid = 501; //rc goblin
			case 5: vehid = 465; //rc raider
			case 6: vehid = 594; // rc cam
			case 7: vehid = 449; //tram
			case 8: return ChangeMenu(playerid,Current,LCars);
		}
		return SelectCar(playerid,vehid,Current);
	}

	return 1;
}

//==============================================================================

public OnPlayerExitedMenu(playerid)
{
    new Menu:Current = GetPlayerMenu(playerid);
    HideMenuForPlayer(Current,playerid);
    PlayerMenu[playerid] = -1;
    return TogglePlayerControllable(playerid,true);
}

//==============================================================================

ChangeMenu(playerid,Menu:oldmenu,Menu:newmenu)
{
	if(IsValidMenu(oldmenu)) {
		HideMenuForPlayer(oldmenu,playerid);
		ShowMenuForPlayer(newmenu,playerid);
	}
	return 1;
}

CloseMenu(playerid,Menu:oldmenu)
{
	HideMenuForPlayer(oldmenu,playerid);
	TogglePlayerControllable(playerid,1);
	return 1;
}
SelectCar(playerid,vehid,Menu:menu)
{
	CloseMenu(playerid,menu);
	SetCameraBehindPlayer(playerid);
	CarSpawner(playerid,vehid);
	return 1;
}
#endif

//==============================================================================
forward countdown();
public countdown()
{
	if(CountDown==6) GameTextForAll("~p~Starting...",1000,6);

	CountDown--;
	if(CountDown==0)
	{
		GameTextForAll("~g~GO~ r~!",1000,6);
		CountDown = -1;
		for(new i=0; i<MAX_PLAYERS; i++)
		{
			PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
		}
		return 0;
	}
	else
	{
		new text2[7]; format(text2,sizeof(text2),"~w~%d",CountDown);
		for(new i=0; i<MAX_PLAYERS; i++)
		{
			PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
		}
	 	GameTextForAll(text2,1000,6);
	}

	SetTimer("countdown",1000,0);
	return 0;
}


//==================== [ Jail & Freeze ]========================================

forward Jail1(player1);
public Jail1(player1)
{
	TogglePlayerControllable(player1,false);
	new Float:x, Float:y, Float:z;	GetPlayerPos(player1,x,y,z);
	SetPlayerCameraPos(player1,x+10,y,z+10);SetPlayerCameraLookAt(player1,x,y,z);
	SetTimerEx("Jail2",1000,0,"d",player1);
}

forward Jail2(player1);
public Jail2(player1)
{
	new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z);
	SetPlayerCameraPos(player1,x+7,y,z+5); SetPlayerCameraLookAt(player1,x,y,z);
	if(GetPlayerState(player1) == PLAYER_STATE_ONFOOT) SetPlayerSpecialAction(player1,SPECIAL_ACTION_HANDSUP);
	GameTextForPlayer(player1,"~r~Busted By Admins",3000,3);
	SetTimerEx("Jail3",1000,0,"d",player1);
}

forward Jail3(player1);
public Jail3(player1)
{
	new Float:x, Float:y, Float:z; GetPlayerPos(player1,x,y,z);
	SetPlayerCameraPos(player1,x+3,y,z); SetPlayerCameraLookAt(player1,x,y,z);
}

forward JailPlayer(player1);
public JailPlayer(player1)
{
	Streamer_UpdateEx(player1,791.2444,-2744.0034,2.3973);
	SetPosAndAngle(player1,791.2444,-2744.0034,2.3973,109.4480);
	SetPlayerFacingAngle(player1, 182.3425);
	SetPlayerInterior(player1,0);
	SetPlayerVirtualWorld(player1, 31121987);
	SetPlayerWorldBounds(player1, 830.0644, 769.5459, -2736.1970, -2747.3831);
	SetCameraBehindPlayer(player1);
	TogglePlayerControllable(player1,true);
	//SetTimerEx("ObjectLoadUnfreeze", 3000, 0, "i", player1);
	JailTimer[player1] = SetTimerEx("JailRelease",PlayerInfo[player1][JailTime],0,"d",player1);
	PlayerInfo[player1][Jailed] = 1;
}

forward ObjectLoadUnfreeze(playerid);
public ObjectLoadUnfreeze(playerid)
{
	TogglePlayerControllable(playerid, true);
	return 1;
}

forward JailRelease(player1);
public JailRelease(player1)
{
	KillTimer( JailTimer[player1] );
	PlayerInfo[player1][JailTime] = 0;  PlayerInfo[player1][Jailed] = 0;
	SetPlayerInterior(player1,0); SetPlayerPos(player1,1551.4375,-1675.5502,15.8488);
	SetPlayerFacingAngle(player1, 90);
	SetPlayerWorldBounds(player1, 9999.9, -9999.9, 9999.9, -9999.9 );
	SetPlayerVirtualWorld(player1, 0);
	PlayerPlaySound(player1,1057,0.0,0.0,0.0);
	GameTextForPlayer(player1,"~g~Released ~n~From Jail",3000,3);
}

//------------------------------------------------------------------------------
forward UnFreezeMe(player1);
public UnFreezeMe(player1)
{
	KillTimer( FreezeTimer[player1] );
	TogglePlayerControllable(player1,true);   PlayerInfo[player1][Frozen] = 0;
	PlayerPlaySound(player1,1057,0.0,0.0,0.0);	GameTextForPlayer(player1,"~g~Unfrozen",3000,3);
}

//==============================================================================
forward RepairCar(playerid);
public RepairCar(playerid)
{
	if(IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid),Pos[playerid][0],Pos[playerid][1],Pos[playerid][2]+0.5);
	SetVehicleZAngle(GetPlayerVehicleID(playerid), Pos[playerid][3]);
	SetCameraBehindPlayer(playerid);
}

//============================ [ Timers ]=======================================
forward weatherchange();
public weatherchange(){
    new rand = random(sizeof(weatherID));
	SetWeather(weatherID[rand][0]);
}

forward PingKick();
public PingKick()
{
	if(ServerInfo[MaxPing] != 0)
	{
	    PingPos++; if(PingPos > PING_MAX_EXCEEDS) PingPos = 0;
        new Sum, Average, x, string[128];
		for(new i=0; i<MAX_PLAYERS; i++)
		{
			PlayerInfo[i][pPing][PingPos] = GetPlayerPing(i);

		    if(GetPlayerPing(i) > ServerInfo[MaxPing])
			{
				if(PlayerInfo[i][PingCount] == 0) PlayerInfo[i][PingTime] = TimeStamp();

	   			PlayerInfo[i][PingCount]++;
				if(TimeStamp() - PlayerInfo[i][PingTime] > PING_TIMELIMIT)
				{
	    			PlayerInfo[i][PingTime] = TimeStamp();
					PlayerInfo[i][PingCount] = 1;
				}
				else if(PlayerInfo[i][PingCount] >= PING_MAX_EXCEEDS)
				{
					while (x < PING_MAX_EXCEEDS) {
						Sum += PlayerInfo[i][pPing][x];
						x++;
					}
					Average = (Sum / PING_MAX_EXCEEDS);
					format(string,sizeof(string),"%s has been kicked from the server. (Reason: High Ping (%d) | Average (%d) | Max Allowed (%d) )", PlayerName2(i), GetPlayerPing(i), Average, ServerInfo[MaxPing] );
  		    		SendClientMessageToAll(grey,string);
					SaveToFile("KickLog",string);
					Kick(i);
				}
			}
			else if(GetPlayerPing(i) < 1 && ServerInfo[AntiBot] == 1)
		    {
				PlayerInfo[i][BotPing]++;
				if(PlayerInfo[i][BotPing] >= 3) BotCheck(i);
		    }
		    else
			{
				PlayerInfo[i][BotPing] = 0;
			}
		}
	}

	#if defined ANTI_MINIGUN
	new weap, ammo, string[128];
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) && PlayerInfo[i][Level] == 0)
		{
			GetPlayerWeaponData(i, 7, weap, ammo);
			if(ammo > 1 && weap == 38) {
		 		format(string,sizeof(string),"INFO: %s has a mingun with %d ammo in his pocket", PlayerName2(i), ammo);
				MessageToAdmins(COLOR_WHITE,string);
			}
		}
	}
	#endif
}

//==============================================================================
forward GodUpdate();
public GodUpdate()
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) && PlayerInfo[i][God] == 1)
		{
			SetPlayerHealth(i,100000);
		}
		if(IsPlayerConnected(i) && PlayerInfo[i][GodCar] == 1 && IsPlayerInAnyVehicle(i))
		{
			SetVehicleHealth(GetPlayerVehicleID(i),10000);
		}
	}
}

//==========================[ Server Info  ]====================================

forward SetConnectPos(playerid);
public SetConnectPos(playerid)
{
	SetPlayerCameraPos(playerid, 1558.3497,-1370.4070,330.0580);
	SetPlayerCameraLookAt(playerid, 1689.2699,-1750.3524,13.3887);
	return 1;
}

forward ConnectedPlayers();
public ConnectedPlayers()
{
	new Connected;
	for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i)) Connected++;
	return Connected;
}

forward JailedPlayers();
public JailedPlayers()
{
	new JailedCount;
	for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Jailed] == 1) JailedCount++;
	return JailedCount;
}

forward FrozenPlayers();
public FrozenPlayers()
{
	new FrozenCount; for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Frozen] == 1) FrozenCount++;
	return FrozenCount;
}

forward MutedPlayers();
public MutedPlayers()
{
	new Count; for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Muted] == 1) Count++;
	return Count;
}

forward InVehCount();
public InVehCount()
{
	new InVeh; for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i)) InVeh++;
	return InVeh;
}

forward OnBikeCount();
public OnBikeCount()
{
	new BikeCount;
	for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i)) {
		new LModel = GetVehicleModel(GetPlayerVehicleID(i));
		switch(LModel)
		{
			case 448,461,462,463,468,471,509,510,521,522,523,581,586:  BikeCount++;
		}
	}
	return BikeCount;
}

forward InCarCount();
public InCarCount()
{
	new PInCarCount;
	for(new i = 0; i < MAX_PLAYERS; i++) {
		if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i)) {
			new LModel = GetVehicleModel(GetPlayerVehicleID(i));
			switch(LModel)
			{
				case 448,461,462,463,468,471,509,510,521,522,523,581,586: {}
				default: PInCarCount++;
			}
		}
	}
	return PInCarCount;
}

forward AdminCount();
public AdminCount()
{
	new LAdminCount;
	for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && PlayerInfo[i][Level] >= 2)	LAdminCount++;
	return LAdminCount;
}

forward RconAdminCount();
public RconAdminCount()
{
	new rAdminCount;
	for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && IsPlayerAdmin(i)) rAdminCount++;
	return rAdminCount;
}

//==========================[ Remote Console ]==================================

forward RestartGM();
public RestartGM()
{
    OnGameModeExit();
	SendRconCommand("gmx");
}

forward UnloadFS();
public UnloadFS()
{
	SendRconCommand("unloadfs ladmin4");
}

forward PrintWarning(const string[]);
public PrintWarning(const string[])
{
    new str[128];
    print("\n\n>		WARNING:\n");
    format(str, sizeof(str), " The  %s  folder is missing from scriptfiles", string);
    print(str);
    print("\n Please Create This Folder And Reload the Filterscript\n\n");
}

//============================[ Bot Check ]=====================================
forward BotCheck(playerid);
public BotCheck(playerid)
{
	if(IsPlayerConnected(playerid))
	{
		if(GetPlayerPing(playerid) < 1)
		{
			new string[128], ip[20];  GetPlayerIp(playerid,ip,sizeof(ip));
			format(string,sizeof(string),"BOT: %s id:%d ip: %s ping: %d",PlayerName2(playerid),playerid,ip,GetPlayerPing(playerid));
			SaveToFile("BotKickLog",string);
		    SaveToFile("KickLog",string);
			printf("[ADMIN] Possible bot has been detected (Kicked %s ID:%d)", PlayerName2(playerid), playerid);
			Kick(playerid);
		}
	}
}

//==============================================================================
forward PutAtPos(playerid);
public PutAtPos(playerid)
{
	if (dUserINT(PlayerName2(playerid)).("x")!=0 && !IsPlayerInAnyVehicle(playerid)) {
     	SetPlayerPos(playerid, float(dUserINT(PlayerName2(playerid)).("x")), float(dUserINT(PlayerName2(playerid)).("y")), float(dUserINT(PlayerName2(playerid)).("z")) );
 		SetPlayerInterior(playerid,	(dUserINT(PlayerName2(playerid)).("interior"))	);
	}
	if (dUserINT(PlayerName2(playerid)).("x")!=0 && IsPlayerInAnyVehicle(playerid)) {
		new car = GetPlayerVehicleID(playerid);
     	SetVehiclePos(car, float(dUserINT(PlayerName2(playerid)).("x")), float(dUserINT(PlayerName2(playerid)).("y")), float(dUserINT(PlayerName2(playerid)).("z")) );
 		SetPlayerInterior(playerid,	(dUserINT(PlayerName2(playerid)).("interior"))	);
	}
}

forward PutAtDisconectPos(playerid);
public PutAtDisconectPos(playerid)
{
	if (dUserINT(PlayerName2(playerid)).("x1")!=0) {
    	SetPlayerPos(playerid, float(dUserINT(PlayerName2(playerid)).("x1")), float(dUserINT(PlayerName2(playerid)).("y1")), float(dUserINT(PlayerName2(playerid)).("z1")) );
		SetPlayerInterior(playerid,	(dUserINT(PlayerName2(playerid)).("interior1"))	);
	}
}

TotalGameTime(playerid, &h=0, &m=0, &s=0)
{
    PlayerInfo[playerid][TotalTime] = ( (gettime() - PlayerInfo[playerid][ConnectTime]) + (PlayerInfo[playerid][hours]*60*60) + (PlayerInfo[playerid][mins]*60) + (PlayerInfo[playerid][secs]) );

    h = floatround(PlayerInfo[playerid][TotalTime] / 3600, floatround_floor);
    m = floatround(PlayerInfo[playerid][TotalTime] / 60,   floatround_floor) % 60;
    s = floatround(PlayerInfo[playerid][TotalTime] % 60,   floatround_floor);

    return PlayerInfo[playerid][TotalTime];
}

//==============================================================================
/*
forward OnPlayerInitiateMinigame(playerid, minigameid);
public OnPlayerInitiateMinigame(playerid, minigameid)
{
	if(minigameid == 1)
	{
	    SendClientMessageToAll(MANAGEMENT, "** %s started a Destruction Derby! Use /derby to join!");
	}
*/
//==============================================================================
MaxAmmo(playerid)
{
	new slot, weap, ammo;
	for (slot = 0; slot < 14; slot++)
	{
    	GetPlayerWeaponData(playerid, slot, weap, ammo);
		if(IsValidWeapon(weap))
		{
		   	GivePlayerWeapon(playerid, weap, 99999);
		}
	}
	return 1;
}

forward ForbiddenAreasTimer();
public ForbiddenAreasTimer()
{
	for(new i=0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
	        new Float:X, Float:Y, Float: Z;
	        GetPlayerPos(i, X, Y, Z);
	        if(IsPlayerInArea(i, 163.6797, 462.8233, 2465.7903, 2552.7390) && Z > 13.3672 && Z < 36.3078 && PlayerInfo[i][Level] < 2 && PlayerInfo[i][InRestricted] == 0)
	        {
				GameTextForPlayer(i, "~r~RESTRICTED AREA", 5000, 4);
				PlayerInfo[i][InRestricted] = 1;
				PlayerInfo[i][RestrictedTimer] = SetTimerEx("KillPlayer", 10000, 0, "i", i);
			}
			else
			{
			    KillTimer(PlayerInfo[i][RestrictedTimer]);
			    if(PlayerInfo[i][InRestricted] > 0)
			    {
			        PlayerInfo[i][InRestricted] = 0;
				}
			}
			#if CHRISTMAS_BUILD == 1
			if(IsPlayerInRangeOfPoint(i, 20.0, 1127.0773,-1453.7225,16.9923))
			{
			    if(ChristmasPlay[i] == 0)
			    {
				    if(!Audio_IsClientConnected(i)) return 1;
					Christmas_Song = Audio_Play(i, 1, false, true, true);
					ChristmasPlay[i] = 1;
					Audio_Set3DPosition(i, Christmas_Song, 1127.0773,-1453.7225,16.9923, 20.0);
				}
			}
			else
			{
			    Audio_Stop(i, Christmas_Song);
			    if(ChristmasPlay[i] == 1)
			    {
			        ChristmasPlay[i] = 0;
				}
			}
			#endif
		}
	}
	return 1;
}

forward NewbieGodMode(playerid);
public NewbieGodMode(playerid)
{
	SetPlayerHealth(playerid, 100);
	SendClientMessage(playerid, MANAGEMENT, "* One minute newbie spawn protection disabled. You're on your own now!");
    NewbieSpawnDone[playerid] = 1;
	return 1;
}

forward SetPlayerLoginRoom(playerid);
public SetPlayerLoginRoom(playerid)
{
    GameTextForPlayer(playerid, " ~n~ ~n~ ~n~ ~n~ ~n~~r~Welcome to PlayLSX!", 4000, 6);
	SetPlayerPos(playerid, -794.7913,490.8889,1376.1953);
	SetPlayerFacingAngle(playerid, 359.1534);
	SetCameraBehindPlayer(playerid);
	SetPlayerInterior(playerid, 1);
	TogglePlayerControllable(playerid, 0);
	if(dUserINT(pName(playerid)).("FavSkin") != -1)
	{
		SetPlayerSkin(playerid, dUserINT(PlayerName2(playerid)).("FavSkin") );
	}
	else
	{
 		SetPlayerSkin(playerid, 0);
	}
	return 1;
}

forward AllowTaxi(playerid);
public AllowTaxi(playerid)
{
	if(IsPlayerConnected(playerid))
	{
		if(PlayerTaxi[playerid] == 1)
		{
	    	PlayerTaxi[playerid] = 0;
		}
	}
	return 1;
}

forward AllowSlap(playerid);
public AllowSlap(playerid)
{
	if(JustSlapped[playerid] == 1)
	{
		JustSlapped[playerid] = 0;
	}
}

forward WantedIcon();
public WantedIcon()
{
	new Float:X, Float:Y, Float:Z;
	GetVehiclePos(WantedCar, X, Y, Z);
	for(new i= 0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
			SetPlayerMapIcon(i, 6, X, Y, Z, 55, MAPICON_GLOBAL);
		}
	}
	return 1;
}

stock GetVehicleName(vehicleid) // Thanks Seif_
{
	new vn[50];
	format(vn,sizeof(vn),"%s",VehicleNames[GetVehicleModel(vehicleid)-400]);
	return vn;
}

stock SendFormattedKick(playerid, const string[])
{
    for(new j = 0; j < 70; j++) SendClientMessage(playerid,Green," ");
    SendClientMessage(playerid,White,"------------------------------------------");
	SendClientMessage(playerid,Red, string);
	SendClientMessage(playerid,White,"------------------------------------------");
	TogglePlayerControllable(playerid,false);
	SetPlayerWeather(playerid,8);
	return 1;
}

stock SendFormattedBan(playerid, const string[])
{
    for(new j = 0; j < 70; j++) SendClientMessage(playerid,Green," ");
    SendClientMessage(playerid,White,"------------------------------------------");
	SendClientMessage(playerid,Red, string);
	SendClientMessage(playerid,Red, "If you don't think this is correct, make an appeal at our forums or come and visit us on IRC.");
    SendClientMessage(playerid,White,"------------------------------------------");
	new istring[128];
	format(istring, sizeof(istring), "Forums: %s", FORUM); SendClientMessage(playerid,Red, istring);
	format(istring, sizeof(istring), "IRC: %s: %d || Channel: %s", IRC_SERVER, IRC_PORT, IRC_CHANNEL); SendClientMessage(playerid,Red, istring);
	format(istring, sizeof(istring), "Thankyou for playing on %s", SERVER_NAME); SendClientMessage(playerid,Red, istring);
	SendClientMessage(playerid,White,"------------------------------------------");
	TogglePlayerControllable(playerid,false);
	SetPlayerWeather(playerid,8);
	return 1;
}

stock SetPosAndAngle(playerid,Float:x,Float:y,Float:z,Float:ang)
{
	SetPlayerPos(playerid, x, y, z);
	SetPlayerFacingAngle(playerid,ang);
	SetCameraBehindPlayer(playerid);
}


stock IsPlayerVIP(playerid)
{
	if(PlayerInfo[playerid][Level] == 1)
	{
		return true;
	}
	return true;
}

stock GetNearestAmmunation(playerid) // Thanks to [HiC]TheKiller & GTAguillaume for help
{
    new Float: X, Float:Y, Float:Z, Float:ClosestAmuDist=99999, Number;
    GetPlayerPos(playerid, X, Y, Z);
    for(new S; S<sizeof(TaxiAmmu); S++)
    {
		new Float:tmpdis = DistanceBetweenPoints(X, Y, Z, TaxiAmmu[S][0], TaxiAmmu[S][1], TaxiAmmu[S][2]);
        if(tmpdis < ClosestAmuDist)
        {
            ClosestAmuDist = tmpdis;
            Number = S;
        }
    }
    return Number;
}

forward Float:DistanceBetweenPoints(Float:x11, Float:y11, Float:z11, Float:x22, Float:y22, Float:z22);
Float:DistanceBetweenPoints(Float:x11, Float:y11, Float:z11, Float:x22, Float:y22, Float:z22)
return floatsqroot(floatpower(floatabs(floatsub(x22,x11)),2)+floatpower(floatabs(floatsub(y22,y11)),2)+floatpower(floatabs(floatsub(z22,z11)),2));

stock PlayerName2(playerid) {
  new name[MAX_PLAYER_NAME];
  GetPlayerName(playerid, name, sizeof(name));
  return name;
}

stock pName(playerid)
{
  new name[MAX_PLAYER_NAME];
  GetPlayerName(playerid, name, sizeof(name));
  return name;
}

stock TimeStamp()
{
	new time = GetTickCount() / 1000;
	return time;
}

stock PlayerSoundForAll(SoundID)
{
	for(new i = 0; i < MAX_PLAYERS; i++) PlayerPlaySound(i, SoundID, 0.0, 0.0, 0.0);
}

stock IsValidWeapon(weaponid)
{
    if (weaponid > 0 && weaponid < 19 || weaponid > 21 && weaponid < 47) return 1;
    return 0;
}

stock IsValidSkin(skinid)
{
	// Created by Simon.
	// Checks whether the skinid parsed is crashable or not. // WHICH IS PRETTY FUCKING GOOD DAWG

	#define	MAX_BAD_SKINS  21

	new badSkins[MAX_BAD_SKINS] = {
		3, 4, 5, 6, 8, 42, 65, 74, 86,
		119, 149, 208, 264, 265, 266, 267,
	    269, 271, 270, 273, 289
	};

	if  (skinid < 0 || skinid > 299) return false;
	for (new i = 0; i < MAX_BAD_SKINS; i++) {
	    if (skinid == badSkins[i]) return false;
	}

	#undef MAX_BAD_SKINS
	return true;
}

stock IsNumeric(string[])
{
	for (new i = 0, j = strlen(string); i < j; i++)
	{
		if (string[i] > '9' || string[i] < '0') return 0;
	}
	return 1;
}

stock ReturnPlayerID(PlayerName[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			if(strfind(pName(i),PlayerName,true)!=-1) return i;
		}
	}
	return INVALID_PLAYER_ID;
}

GetVehicleModelIDFromName(vname[])
{
	for(new i = 0; i < 211; i++)
	{
		if ( strfind(VehicleNames[i], vname, true) != -1 )
			return i + 400;
	}
	return -1;
}

 // Spawn weapon shit, because Jay owns life.
stock GivePlayerSpawnWeapon(iPlayerID,iWeaponID,iAmmo)
{
	// Is the player connected? If not, what a wanker.
	if(!IsPlayerConnected(iPlayerID))
	    return false;
	// Is the weapon ID valid? Nigga plz ...
	if(iWeaponID < 1 || iWeaponID > 50)
	    return false;

	// If a player already has this spawn weapon, just add the ammo. gfgfgfffff
	if(iPlayerSpawnWeapon[iPlayerID][iWeaponID] > 0)
	{
	    iPlayerSpawnWeapon[iPlayerID][iWeaponID] += iAmmo;
		GivePlayerWeapon(iPlayerID,iWeaponID,iAmmo);
		return 1;
	}

	iPlayerSpawnWeapon[iPlayerID][iWeaponID] = iAmmo;
	GivePlayerWeapon(iPlayerID,iWeaponID,iAmmo);
	return true;
}

AntiDeAMX() // Anti-Docompile code by Zezombia
{
	new a[][] =
	{
		"Unarmed (Fist)",
		"Brass K"
	};
	#pragma unused a
}

stock SetVehiclePlate(vehicleid, plate[])
{
	SetVehicleNumberPlate(vehicleid, plate);
	SetVehicleToRespawn(vehicleid);
	return 1;
}

stock GetWeaponIDFromName(WeaponName[])
{
	if(strfind("molotov",WeaponName,true)!=-1) return 18;
	for(new i = 0; i <= 46; i++)
	{
		switch(i)
		{
			case 0,19,20,21,44,45: continue;
			default:
			{
				new name[32]; GetWeaponName(i,name,32);
				if(strfind(name,WeaponName,true) != -1) return i;
			}
		}
	}
	return -1;
}

stock DisableWord(const badword[], text[])
{
   	for(new i=0; i<128; i++)
   	{
		if (strfind(text[i], badword, true) == 0)
		{
			for(new a=0; a<128; a++)
			{
				if (a >= i && a < i+strlen(badword)) text[a]='*';
			}
		}
	}
}

argpos(const string[], idx = 0, sep = ' ')// (by yom)
{
    for(new i = idx, j = strlen(string); i < j; i++)
        if (string[i] == sep && string[i+1] != sep)
            return i+1;

    return -1;
}

//==============================================================================
forward XtremeChat(color,const string[]);
public XtremeChat(color, const string[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) == 1) if (PlayerInfo[i][Regular] >= 1 || PlayerInfo[i][Level] >= 2) SendClientMessage(i, color, string);
	}
	return 1;
}

forward MessageToVIPz(color,const string[]);
public MessageToVIPz(color,const string[])
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) == 1) if (PlayerInfo[i][Level] >= 1) SendClientMessage(i, color, string);
	}
	return 1;
}

forward MessageToMods(color,const string[]);
public MessageToMods(color,const string[])
{
	new str[128];
	format(str, sizeof(str), "Mod Message: %s", string);
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) == 1) if (PlayerInfo[i][Level] >= 2) SendClientMessage(i, color, str);
	}
	return 1;
}

forward MessageToAdmins(color,const string[]);
public MessageToAdmins(color,const string[])
{
	new str[128];
	format(str, sizeof(str), " %s", string);
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) == 1) if (PlayerInfo[i][Level] >= 3) SendClientMessage(i, color, str);
	}
	return 1;
}

stock CMDMessageToAdmins(playerid,command[])
{
	if(ServerInfo[AdminCmdMsg] == 0) return 1;
	new string[128]; GetPlayerName(playerid,string,sizeof(string));
	format(string,sizeof(string)," %s has used the command %s",string,command);
	return MessageToAdmins(MAD_WHITE,string);
}

forward ClearChat(playerid);
public ClearChat(playerid)
{
    for(new i = 0; i < 70; i++)
	{
		SendClientMessage(playerid,green," ");
		return 1;
	}
	return 1;
}

//==============================================================================
forward SavePlayer(playerid);
public SavePlayer(playerid)
{
   	dUserSetINT(PlayerName2(playerid)).("money",GetPlayerMoney(playerid));
   	dUserSetINT(PlayerName2(playerid)).("kills",PlayerInfo[playerid][Kills]);
   	dUserSetINT(PlayerName2(playerid)).("deaths",PlayerInfo[playerid][Deaths]);
	dUserSetINT(PlayerName2(playerid)).("Regular",PlayerInfo[playerid][Regular]);
	dUserSetINT(PlayerName2(playerid)).("Developer",PlayerInfo[playerid][Developer]);
	dUserSetINT(PlayerName2(playerid)).("Bank",PlayerInfo[playerid][Bank]);
	dUserSetINT(PlayerName2(playerid)).("Cookies",PlayerInfo[playerid][Cookies]);
	dUserSetINT(PlayerName2(playerid)).("TeleMsg",PlayerInfo[playerid][TeleMsg]);
 	dUserSetINT(PlayerName2(playerid)).("SpawnColour",PlayerInfo[playerid][SpawnColour]);
 	dUserSetINT(PlayerName2(playerid)).("HoldingObject",PlayerInfo[playerid][HoldingObject]);
 	dUserSetINT(PlayerName2(playerid)).("ObjectStatus",PlayerInfo[playerid][ObjectStatus]);
 	dUserSetINT(PlayerName2(playerid)).("AutoFix",PlayerInfo[playerid][AutoFix]);
	dUserSetINT(PlayerName2(playerid)).("xAccount",PlayerInfo[playerid][xAccount]);
	dUserSetINT(PlayerName2(playerid)).("CarKey",PlayerInfo[playerid][CarKey]);
	dUserSetINT(PlayerName2(playerid)).("Licence",PlayerInfo[playerid][Licence]);
	dUserSetINT(PlayerName2(playerid)).("MyTime",PlayerInfo[playerid][MyTime]);
	dUserSetINT(PlayerName2(playerid)).("MyHour",PlayerInfo[playerid][MyHour]);
	dUserSetINT(PlayerName2(playerid)).("FavSkin",PlayerInfo[playerid][FavSkin]);

	new h, m, s;
    TotalGameTime(playerid, h, m, s);

	dUserSetINT(PlayerName2(playerid)).("hours", h);
	dUserSetINT(PlayerName2(playerid)).("minutes", m);
	dUserSetINT(PlayerName2(playerid)).("seconds", s);

   	new Float:x,Float:y,Float:z, interior;
   	GetPlayerPos(playerid,x,y,z);	interior = GetPlayerInterior(playerid);
    dUserSetINT(PlayerName2(playerid)).("x1",floatround(x));
	dUserSetINT(PlayerName2(playerid)).("y1",floatround(y));
	dUserSetINT(PlayerName2(playerid)).("z1",floatround(z));
    dUserSetINT(PlayerName2(playerid)).("interior1",interior);

	new	Float:health;	GetPlayerHealth(playerid, Float:health);
	new	Float:armour;	GetPlayerArmour(playerid, Float:armour);
	new year,month,day;	getdate(year, month, day);
	new strdate[20];	format(strdate, sizeof(strdate), "%d.%d.%d",day,month,year);
	new file[128]; 		format(file,sizeof(file),"/lsx/users/%s.sav",udb_encode(PlayerName2(playerid)) );

	dUserSetINT(PlayerName2(playerid)).("health",floatround(health));
    dUserSetINT(PlayerName2(playerid)).("armour",floatround(armour));
	dini_Set(file,"LastOn",strdate);
	//dini_Set(file,"CustomMsgLeave", PlayerInfo[playerid][CustomMsgLeave]);
	dUserSetINT(PlayerName2(playerid)).("loggedin",0);
	dUserSetINT(PlayerName2(playerid)).("TimesOnServer",(dUserINT(PlayerName2(playerid)).("TimesOnServer"))+1);
	#if BETA_BUILD == 1
	SendClientMessage(playerid, White, "Your player stats have been saved [Function: SavePlayer()]");
	#endif
	return printf("PlayerInfo saved for %s[%d]", pName(playerid), playerid);
}

//==============================================================================
#if defined USE_MENUS
DestroyAllMenus()
{
	DestroyMenu(LVehicles); DestroyMenu(twodoor); DestroyMenu(fourdoor); DestroyMenu(fastcar); DestroyMenu(Othercars);
	DestroyMenu(bikes); DestroyMenu(boats); DestroyMenu(planes); DestroyMenu(helicopters ); DestroyMenu(LTime);
	DestroyMenu(XWeapons); DestroyMenu(XWeaponsBig); DestroyMenu(XWeaponsSmall); DestroyMenu(XWeaponsMore);
	DestroyMenu(LWeather); DestroyMenu(LTuneMenu); DestroyMenu(PaintMenu); DestroyMenu(LCars); DestroyMenu(LCars2);
	DestroyMenu(LTele); DestroyMenu(LasVenturasMenu); DestroyMenu(LosSantosMenu); DestroyMenu(SanFierroMenu);
	DestroyMenu(LMainMenu); DestroyMenu(DesertMenu); DestroyMenu(FlintMenu); DestroyMenu(MountChiliadMenu); DestroyMenu(InteriorsMenu);
	DestroyMenu(AdminEnable); DestroyMenu(AdminDisable);
}
#endif

//==============================================================================
#if defined DISPLAY_CONFIG
stock ConfigInConsole()
{
	print(" ________ Configuration ___________\n");
	print(" __________ Chat & Messages ______");
	if(ServerInfo[AntiSwear] == 0) print("  Anti Swear:              Disabled "); else print("  Anti Swear:             Enabled ");
	if(ServerInfo[AntiSpam] == 0)  print("  Anti Spam:               Disabled "); else print("  Anti Spam:              Enabled ");
	if(ServerInfo[ReadCmds] == 0)  print("  Read Cmds:               Disabled "); else print("  Read Cmds:              Enabled ");
	if(ServerInfo[ReadPMs] == 0)   print("  Read PMs:                Disabled "); else print("  Read PMs:               Enabled ");
	if(ServerInfo[ConnectMessages] == 0) print("  Connect Messages:        Disabled "); else print("  Connect Messages:       Enabled ");
  	if(ServerInfo[AdminCmdMsg] == 0) print("  Admin Cmd Messages:     Disabled ");  else print("  Admin Cmd Messages:     Enabled ");
	if(ServerInfo[ReadPMs] == 0)   print("  Anti capital letters:    Disabled \n"); else print("  Anti capital letters:   Enabled \n");
	print(" __________ Skins ________________");
	if(ServerInfo[AdminOnlySkins] == 0) print("  AdminOnlySkins:         Disabled "); else print("  AdminOnlySkins:         Enabled ");
	printf("  Admin Skin 1 is:         %d", ServerInfo[AdminSkin] );
	printf("  Admin Skin 2 is:         %d\n", ServerInfo[AdminSkin2] );
	print(" ________ Server Protection ______");
	if(ServerInfo[AntiBot] == 0) print("  Anti Bot:                Disabled "); else print("  Anti Bot:                Enabled ");
	if(ServerInfo[NameKick] == 0) print("  Bad Name Kick:           Disabled\n"); else print("  Bad Name Kick:           Enabled\n");
	print(" __________ Ping Control _________");
	if(ServerInfo[MaxPing] == 0) print("  Ping Control:            Disabled"); else print("  Ping Control:            Enabled");
	printf("  Max Ping:                %d\n", ServerInfo[MaxPing] );
	print(" __________ Players ______________");
	if(ServerInfo[GiveWeap] == 0) print("  Save/Give Weaps:         Disabled"); else print("  Save/Give Weaps:         Enabled");
	if(ServerInfo[GiveMoney] == 0) print("  Save/Give Money:         Disabled\n"); else print("  Save/Give Money:         Enabled\n");
	print(" __________ Other ________________");
	printf("  Max Admin Level:         %d", ServerInfo[MaxAdminLevel] );
	if(ServerInfo[Locked] == 0) print("  Server Locked:           No"); else print("  Server Locked:           Yes");
	if(ServerInfo[AutoLogin] == 0) print("  Auto Login:             Disabled\n"); else print("  Auto Login:              Enabled\n");
}
#endif

//=====================[ Configuration ] =======================================
stock UpdateConfig()
{
	new file[128], File:file2, string[100]; format(file,sizeof(file),"lsx/config/Config.ini");
	ForbiddenWordCount = 0;
	BadNameCount = 0;
	BadPartNameCount = 0;

	if(!dini_Exists("lsx/config/aka.txt")) dini_Create("lsx/config/aka.txt");

	if(!dini_Exists(file))
	{
		dini_Create(file);
		print("\n >Configuration File Successfully Created");
	}

	if(!dini_Isset(file,"MaxPing")) dini_IntSet(file,"MaxPing",1200);
	if(!dini_Isset(file,"ReadPms")) dini_IntSet(file,"ReadPMs",1);
	if(!dini_Isset(file,"ReadCmds")) dini_IntSet(file,"ReadCmds",1);
	if(!dini_Isset(file,"MaxAdminLevel")) dini_IntSet(file,"MaxAdminLevel",5);
	if(!dini_Isset(file,"AdminOnlySkins")) dini_IntSet(file,"AdminOnlySkins",0);
	if(!dini_Isset(file,"AdminSkin")) dini_IntSet(file,"AdminSkin",217);
	if(!dini_Isset(file,"AdminSkin2")) dini_IntSet(file,"AdminSkin2",214);
	if(!dini_Isset(file,"AntiBot")) dini_IntSet(file,"AntiBot",1);
	if(!dini_Isset(file,"AntiSpam")) dini_IntSet(file,"AntiSpam",1);
	if(!dini_Isset(file,"AntiSwear")) dini_IntSet(file,"AntiSwear",1);
	if(!dini_Isset(file,"NameKick")) dini_IntSet(file,"NameKick",1);
 	if(!dini_Isset(file,"PartNameKick")) dini_IntSet(file,"PartNameKick",1);
	if(!dini_Isset(file,"NoCaps")) dini_IntSet(file,"NoCaps",0);
	if(!dini_Isset(file,"Locked")) dini_IntSet(file,"Locked",0);
	if(!dini_Isset(file,"SaveWeap")) dini_IntSet(file,"SaveWeap",1);
	if(!dini_Isset(file,"SaveMoney")) dini_IntSet(file,"SaveMoney",1);
	if(!dini_Isset(file,"ConnectMessages")) dini_IntSet(file,"ConnectMessages",1);
	if(!dini_Isset(file,"AdminCmdMessages")) dini_IntSet(file,"AdminCmdMessages",1);
	if(!dini_Isset(file,"AutoLogin")) dini_IntSet(file,"AutoLogin",1);
	if(!dini_Isset(file,"MaxMuteWarnings")) dini_IntSet(file,"MaxMuteWarnings",4);
	if(!dini_Isset(file,"MustLogin")) dini_IntSet(file,"MustLogin",0);
	if(!dini_Isset(file,"MustRegister")) dini_IntSet(file,"MustRegister",0);

	if(dini_Exists(file))
	{
		ServerInfo[MaxPing] = dini_Int(file,"MaxPing");
		ServerInfo[ReadPMs] = dini_Int(file,"ReadPMs");
		ServerInfo[ReadCmds] = dini_Int(file,"ReadCmds");
		ServerInfo[MaxAdminLevel] = dini_Int(file,"MaxAdminLevel");
		ServerInfo[AdminOnlySkins] = dini_Int(file,"AdminOnlySkins");
		ServerInfo[AdminSkin] = dini_Int(file,"AdminSkin");
		ServerInfo[AdminSkin2] = dini_Int(file,"AdminSkin2");
		ServerInfo[AntiBot] = dini_Int(file,"AntiBot");
		ServerInfo[AntiSpam] = dini_Int(file,"AntiSpam");
		ServerInfo[AntiSwear] = dini_Int(file,"AntiSwear");
		ServerInfo[NameKick] = dini_Int(file,"NameKick");
		ServerInfo[PartNameKick] = dini_Int(file,"PartNameKick");
		ServerInfo[NoCaps] = dini_Int(file,"NoCaps");
		ServerInfo[Locked] = dini_Int(file,"Locked");
		ServerInfo[GiveWeap] = dini_Int(file,"SaveWeap");
		ServerInfo[GiveMoney] = dini_Int(file,"SaveMoney");
		ServerInfo[ConnectMessages] = dini_Int(file,"ConnectMessages");
		ServerInfo[AdminCmdMsg] = dini_Int(file,"AdminCmdMessages");
		ServerInfo[AutoLogin] = dini_Int(file,"AutoLogin");
		ServerInfo[MaxMuteWarnings] = dini_Int(file,"MaxMuteWarnings");
		ServerInfo[MustLogin] = dini_Int(file,"MustLogin");
		ServerInfo[MustRegister] = dini_Int(file,"MustRegister");
		print("\n -Configuration Settings Loaded");
	}

	//forbidden names
	if((file2 = fopen("lsx/config/ForbiddenNames.cfg",io_read)))
	{
		while(fread(file2,string))
		{
		    for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
            BadNames[BadNameCount] = string;
            BadNameCount++;
		}
		fclose(file2);	printf(" -%d Forbidden Names Loaded", BadNameCount);
	}

	//forbidden part of names
	if((file2 = fopen("lsx/config/ForbiddenPartNames.cfg",io_read)))
	{
		while(fread(file2,string))
		{
		    for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
            BadPartNames[BadPartNameCount] = string;
            BadPartNameCount++;
		}
		fclose(file2);	printf(" -%d Forbidden Tags Loaded", BadPartNameCount);
	}
	//forbidden words
	if((file2 = fopen("lsx/config/ForbiddenWords.cfg",io_read)))
	{
		while(fread(file2,string))
		{
		    for(new i = 0, j = strlen(string); i < j; i++) if(string[i] == '\n' || string[i] == '\r') string[i] = '\0';
            ForbiddenWords[ForbiddenWordCount] = string;
            ForbiddenWordCount++;
		}
		fclose(file2);	printf(" -%d Forbidden Words Loaded", ForbiddenWordCount);
	}
}
//=====================[ SAVING DATA ] =========================================

forward SaveToFile(filename[],text[]);
public SaveToFile(filename[],text[])
{
	#if defined SAVE_LOGS
	new File:LAdminfile, filepath[128], string[128], year,month,day, hour,minute,second;
	getdate(year,month,day); gettime(hour,minute,second);

	format(filepath,sizeof(filepath),"lsx/logs/%s.txt",filename);
	LAdminfile = fopen(filepath,io_append);
	format(string,sizeof(string),"[%d.%d.%d %d:%d:%d] %s\r\n",day,month,year,hour,minute,second,text);
	fwrite(LAdminfile,string);
	fclose(LAdminfile);
	#endif

	return 1;
}

// Thanks LVP ;)
#if CHRISTMAS_BUILD == 1
GetPresentZone(presentid)
{
	new Float:x, Float:y, Float:z;
	x = surprise[presentid][0];
	y = surprise[presentid][1];
	z = surprise[presentid][2];
	new zoneName[64];
	for(new i=0; i<375; i++){
		if(ZoneInfo[i][zonePosx1] < x && ZoneInfo[i][zonePosx2] > x){
			if(ZoneInfo[i][zonePosy1] < y && ZoneInfo[i][zonePosy2] > y){
				if(ZoneInfo[i][zonePosz1] < z && (ZoneInfo[i][zonePosz2]+100) > z){
					format(zoneName, 64, "%s", ZoneInfo[i][ZoneName]);
				}
			}
		}
	}
	return zoneName;
}

forward GiftMove();
public GiftMove()
{
	new string[128], gID;
	if(!IsValidDynamicPickup(giftPickup))
	{
		gID = random(57);
		giftID = gID;
		giftPickup = CreateDynamicPickup(1578, 15, surprise[gID][0], surprise[gID][1], surprise[gID][2]);
		format(string, sizeof(string), "Santa's little helpers have placed a new present, it's located somewhere near %s!", GetPresentZone(gID));
		SendClientMessageToAll(MANAGEMENT, string);
	}
	else
	{
	    DestroyDynamicPickup(giftPickup);
	    gID = random(57);
	    giftID = gID;
		giftPickup = CreateDynamicPickup(1578, 15, surprise[gID][0], surprise[gID][1], surprise[gID][2]);
		format(string, sizeof(string), "Santa's little helpers have placed a new present, it's located somewhere near %s!", GetPresentZone(gID));
		SendClientMessageToAll(MANAGEMENT, string);
	}
	return 1;
}
#endif

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnPlayerPickUpDynamicPickup(playerid, pickupid)
{
	new string[128];
	#if CHRISTMAS_BUILD == 1
	//Christmas surprises :D
	new giftamount;
	if(pickupid == giftPickup)
	{
	    giftamount = random(MAX_GIFT_MONEY);
	    GivePlayerMoney(playerid, giftamount);
	    format(string, sizeof(string), "%s has found the surprise from Santa and won $%d",pName(playerid), giftamount);
	    SendClientMessageToAll(red, string);
	    format(string, sizeof(string), "PM from Santa[2512]: Ho, Ho, Ho! You found one of my presents, enjoy the $%d", giftamount);
	    SendClientMessage(playerid, DAYTONA_YELLOW, string);

		if(IsValidDynamicPickup(giftPickup))
		{
		    DestroyDynamicPickup(giftPickup);
		}
		giftPickup = -1;
		giftID = -1;
		SetTimer("GiftMove", 300000, 0);
	}
	#endif

	if(pickupid == JailHelp)
	{
	    ShowPlayerDialog(playerid, JAIL_HELP, DIALOG_STYLE_MSGBOX, "You have been jailed!", "You have been jailed, either automatically or by an Administrator.\n Please make sure you follow all rules, or you will spend a lot \nof time on this island! please do not try to escape, you \n will be automatically killed. Have fun!", "Ok", "Cancel");
	}
    if (pickupid == Rule1)
	{
	    SendClientMessage(playerid, DAYTONA_YELLOW, "===========================");
	    SendClientMessage(playerid, White, "The use of cheating tools or hacking of any kind");
	    SendClientMessage(playerid, White, "is not permitted in Los Santos Xtreme. Anybody");
	    SendClientMessage(playerid, White, "found using cheats or exploiting the server in any way");
	    SendClientMessage(playerid, White, "will be subjected to a permanant ban from all LSX Services.");
        SendClientMessage(playerid, DAYTONA_YELLOW, "===========================");
	}
	if (pickupid == Rule2)
	{
	    SendClientMessage(playerid, DAYTONA_YELLOW, "===========================");
	    SendClientMessage(playerid, White, "This is Grand Theft Auto, a violent game, and as such");
	    SendClientMessage(playerid, White, "will contain some amount of violence. Flaming another player");
	    SendClientMessage(playerid, White, "excessively is not permitted. Neither are racial or discriminatory terms");
	    SendClientMessage(playerid, White, "permitted and if used, you should expect to be punished.");
        SendClientMessage(playerid, DAYTONA_YELLOW, "===========================");
	}
	if (pickupid == Rule3)
	{
	    SendClientMessage(playerid, DAYTONA_YELLOW, "===========================");
	    SendClientMessage(playerid, White, "If you ever fiind yourself in a spot of trouble, or");
	    SendClientMessage(playerid, White, "need help of any sort, we are always here to help you!");
	    SendClientMessage(playerid, White, "You can contact an Administrator using @[text] and somebody");
	    SendClientMessage(playerid, White, "will come to your rescue! (If any Admins are online).");
        SendClientMessage(playerid, DAYTONA_YELLOW, "===========================");
	}
	if (pickupid == Rule4)
	{
	    SendClientMessage(playerid, DAYTONA_YELLOW, "===========================");
	    SendClientMessage(playerid, White, "Firstly, you should read and make sure you understand");
	    SendClientMessage(playerid, White, "/rules. Also, we have detailed help sections which will");
	    SendClientMessage(playerid, White, "guide you through many parts of Los Santos Xtreme.");
	    SendClientMessage(playerid, White, "This can be found by using the /help command.");
        SendClientMessage(playerid, DAYTONA_YELLOW, "===========================");
	}
	if (pickupid == Newb_Wep1)
	{
	    GivePlayerWeapon(playerid, 26, 35);
	    SendClientMessage(playerid, MANAGEMENT, "* You recieved a Sawnoff Shotgun with 35 rounds!");
	}
	if (pickupid == Newb_Wep2)
	{
	    GivePlayerWeapon(playerid, 28, 35);
	    SendClientMessage(playerid, MANAGEMENT, "* You recieved an Uzi with 35 rounds!");
	}
	if (pickupid == SecretHax1)
	{
		SendClientMessage(playerid,DAYTONA_YELLOW,"*** You found a secret pickup!");
		GivePlayerWeapon(playerid, 4, 1);
		new str[128];
		format(str,sizeof(str),"[ALERT] %s has found a secret knife pickup!",PlayerName2(playerid));
		MessageToAdmins(red,str);
	}
    if (pickupid == shippickup)
	{
		SendClientMessage(playerid, Orange, "This is the safezone. Killing is forbidden whilst you're here.");
        SendClientMessage(playerid, Orange, "You will earn $100 per second for standing in the safezone");
        SendClientMessage(playerid, Orange, "You can idle in the zone but remember, after 10 minutes of idling");
        SendClientMessage(playerid, Orange, "you will be automatically kicked from the server!");
    }
	if (pickupid == bankpickup)
	{
		SetPlayerInterior(playerid,0);
		InBank[playerid] = 1;
		SetPlayerPos(playerid,2309.1338,-15.3476,26.7496);
		SetPlayerFacingAngle(playerid,270);
		SetPlayerCheckpoint(playerid,2316.2214,-7.5546,26.7422,2.0);
		if(PlayerInfo[playerid][xAccount] < 1) {
		    SendClientMessage(playerid,MANAGEMENT,"Welcome to the bank of Los Santos. Use /bank to deposit, /withdraw to take money");
            SendClientMessage(playerid,MANAGEMENT,"from your account or /balance to check your balance.");
            SendClientMessage(playerid,MANAGEMENT,"To upgrade your account to the xAccount, walk into the checkpoint and type /account upgrade.");
            return 1;
		}
		SendClientMessage(playerid,MANAGEMENT,"Welcome to the bank of Los Santos!");
	}
	if (pickupid == bankexit)
	{
	   SetPlayerPos(playerid,594.2761,-1243.5648,18.0641);
	   SetPlayerFacingAngle(playerid,30);
	   SetCameraBehindPlayer(playerid);
	   DisablePlayerCheckpoint(playerid);
	   InBank[playerid] = 0;
	}

	if (pickupid == sawnoff2)

	{
        GivePlayerWeapon(playerid, 26, 50);
    }

	if (pickupid == uzi2)

    {
		GivePlayerWeapon(playerid, 28, 50);
	}

	if (pickupid == fcinfo)

	{
		SendClientMessage(playerid, Green, "Welcome to Fight Club. This is where the duels happen.");
		SendClientMessage(playerid, Green, "If you are NOT fighting and there is a fight already on");
		SendClientMessage(playerid, Green, "DO NOT interrupt the fight or you will be kicked.");
		SendClientMessage(playerid, Green, "See the forum for rules regarding the use of bugs (2-shot, etc.)");
    }

	if (pickupid == SpawnMenu)
	{
		TogglePlayerControllable(playerid,false);
		ShowMenuForPlayer(weaponmenu,playerid);
	}
	if (pickupid == SpawnMenu2)
	{
		TogglePlayerControllable(playerid,false);
		ShowMenuForPlayer(weaponmenu,playerid);
	}
	if (pickupid == LicenceCentre)
	{
		SetPlayerPos(playerid,1170.6493,1361.0414,10.9293);
		SetPlayerVirtualWorld(playerid,256);
		SetPlayerFacingAngle(playerid,90);
		SetCameraBehindPlayer(playerid);
		SetPlayerCheckpoint(playerid,1173.2203,1350.9459,10.9219,1.0);
		SendClientMessage(playerid,MANAGEMENT,"** Welcome to the licence centre. To buy your licence type /licence");
	}
	if (pickupid == LicenceExit)
	{
	    SetPlayerPos(playerid,1226.3840,-1816.0887,16.5938);
	    SetPlayerVirtualWorld(playerid,0);
		SetPlayerFacingAngle(playerid,238);
		SetCameraBehindPlayer(playerid);
		SetPlayerInterior(playerid,0);
		DisablePlayerCheckpoint(playerid);
		SendClientMessage(playerid,MANAGEMENT,"** Exited licence centre! Have fun driving!");
	}
// Admin room FOR THE GANGSTAHHHZZ ... WUT UP NIGGA WUT UUUUUUUP //
    if (pickupid == AdminLoungeEnter)
    {
        if(PlayerInfo[playerid][Level] >= 3)
		{
		 SetPlayerInterior(playerid,2);
		 SetPlayerPos(playerid,2529.9326,-1285.8068,1054.6406);
		 SetPlayerFacingAngle(playerid,270.3417);
		 SendClientMessage(playerid,MANAGEMENT,"Welcome to the Administrators Lounge! Time to relax after all that hard work?");
        } else return SendClientMessage(playerid,MANAGEMENT,"Sorry, but only super cool administrators are allowed access here!");

    }

    if (pickupid == AdminLoungeExit)
    {
        if(PlayerInfo[playerid][Level] >= 3)
		{
		 SetPlayerInterior(playerid,0);
		 SetPlayerPos(playerid,1537.7196,-1279.2771,17.4069);
		 SetPlayerFacingAngle(playerid,131.2359);
		 SetPlayerHealth(playerid,150.0);
		 SetPlayerArmour(playerid,150.0);
		 SendClientMessage(playerid,MANAGEMENT,"Back to work then, an admins work is never done! :O");
        } else return SendClientMessage(playerid,MANAGEMENT,"How did you get in here? GTFO before we ban your ass!");

	}

    if (pickupid == AdminRoofEnter)
    {
        if(PlayerInfo[playerid][Level] >= 3)
		{
		 SetPlayerInterior(playerid,0);
		 SetPlayerPos(playerid,1565.8610,-1242.7899,277.8771);
		 SetPlayerFacingAngle(playerid,96.4255);
		 SendClientMessage(playerid,MANAGEMENT,"*** Administrators rooftop, fire some of them rockets at unsuspecting players, or fly the hunter!");
        }
        else
        {
			SetPlayerHealth(playerid, 0);
		 	SendClientMessage(playerid,red,"Alert! Intruder detected, securing area! kthxbai!");
		}
    }
    if (pickupid == AdminRoofExit)
    {
		if(PlayerInfo[playerid][Level] >= 3)
		{
		 SetPlayerInterior(playerid,2);
		 SetPlayerPos(playerid,2529.9326,-1285.8068,1054.6406);
		 SetPlayerFacingAngle(playerid,270.3417);
         SendClientMessage(playerid,MANAGEMENT,"Welcome back to the Lounge!");
		} else return SendClientMessage(playerid,MANAGEMENT,"Access to the Administrator Lounge is denied to you.");

	}
	
// End Of leet gangstuuuuh admin hack .. start of elite V.I.P. HACKS OMFGBBQ!

	if (pickupid == VIPEnter)
	{
        if(PlayerInfo[playerid][Level] >= 1)
		{
         	InVipRoom[playerid] = 1;
		 	SetPlayerPos(playerid,1801.9274,-1300.7349,109.3359);
         	SetPlayerFacingAngle(playerid,123.5808);
		 	SendClientMessage(playerid,MANAGEMENT,"Welcome to the V.I.P. room donator!");
         	format(string, sizeof(string),"%s has entered the V.I.P. Lounge!",PlayerName2(playerid));
	   	 	MessageToAdmins(VIP,string);
		}
	}
	if(pickupid == VIPExit)
	{
	    if(PlayerInfo[playerid][Level] >= 1)
	    {
	        InVipRoom[playerid] = 0;
	        SetPosAndAngle(playerid,1788.4669+2,-1297.8236+2,13.3750,0);
	        SendClientMessage(playerid,MANAGEMENT,"You have left the V.I.P lounge, have fun!");
         	format(string, sizeof(string),"%s has exited the V.I.P. lounge!",PlayerName2(playerid));
	   	 	MessageToAdmins(VIP,string);
		}
		else
		{
		    SendClientMessage(playerid, MANAGEMENT, "How did you get in here?!");
		    format(string, sizeof(string), "%s[%d] has tried to exit the V.I.P lounge without V.I.P permission.",pName(playerid), playerid);
		    MessageToAdmins(VIP, string);
		}
	}
	// Property Pickup Handling
	if(IsPlayerNearProperty( playerid ) != -1 )
	{
		OnPropertyPickupPickup( playerid , pickupid );
	}
	return 1;
}
/*
The following function is called every second, and will check each connected player
for their position,if when checked they are found to be in an area contained inside
this function, they will be subject to any code inside the position statement.
*/

forward CheckPlayerAreas();
public CheckPlayerAreas()
{
	//new string[128];
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
	        #if INIT_MAP_MYLAND == 1
	        
	        if(PlayerInfo[i][Level] >= 3)
	        {
	            if(!IsPlayerInAnyVehicle(i))
	            {
		            if(IsPlayerInRangeOfPoint(i, 1.0, -6140.8862,1631.2991,2.1571))
		            {
				 		SetPosAndAngle(i, 302.7426, 309.9407, 1003.3046, 180);
				 		SetPlayerInterior(i,4);
		         		SendClientMessage(i,MANAGEMENT,"Entered B1 SAF (Armoury)");
					}
					if(IsPlayerInRangeOfPoint(i, 1.0, 301.6825, 305.2616, 1003.5390))
		            {
		                SetPosAndAngle(i, -6141.0469,1635.3485,2.1574,358.5696);
		                SetPlayerInterior(i,0);
		                SetPlayerVirtualWorld(i, 311287); // Not really needed here but, just in case =p
		                InitObjsForPlayer(i);
					}
					if(IsPlayerInRangeOfPoint(i, 1.0, -6173.6655,1696.2181,2.4610))
		            {
		                SetPosAndAngle(i, 234.0897, 1083.3352, 1084.2343,180.9979);
		                SetPlayerInterior(i,6);
					}
					if(IsPlayerInRangeOfPoint(i, 1.0, -6138.4927,1695.8464,2.4670))
		            {
		                SetPosAndAngle(i, 234.0878, 1067.4317, 1084.2067,358.5696);
		                SetPlayerInterior(i,6);
					}
					if(IsPlayerInRangeOfPoint(i, 1.0, 234.2267, 1064.6352, 1084.2109) && GetPlayerVirtualWorld(i) == 311287)
		            {
		                SetPosAndAngle(i, -6133.7432,1696.1533,2.4628,268.0465);
		                SetPlayerInterior(i,0);
		                InitObjsForPlayer(i);
					}
					if(IsPlayerInRangeOfPoint(i, 1.0, 232.3971, 1085.6048, 1084.2331) && GetPlayerVirtualWorld(i) == 311287)
		            {
		                SetPosAndAngle(i, -6179.8110,1702.9664,2.3718,359.3587);
		                SetPlayerInterior(i,0);
		                InitObjsForPlayer(i);
					}
				}
				if(IsPlayerInRangeOfPoint(i, 3.0, -6165.7021,1737.1786,1.8171))
				{
				    if(IsPlayerInAnyVehicle(i))
				    {
				        if(b1AutoGateStatus[0] == 0)
				        {
				            MoveDynamicObject(b1AutoGate[0], -6160.70507812,1734.60412598,-4.14656250, 10.0);
				            MoveDynamicObject(b1AutoGate[1], -6160.37255859,1740.00256348,-4.14656250, 10.0);
                            b1AutoGateStatus[0] = 1; // open
						}
					}
				}
				if(IsPlayerInRangeOfPoint(i, 3.0, -6154.9365,1726.1698,1.8175))
				{
				    if(IsPlayerInAnyVehicle(i))
				    {
				        if(b1AutoGateStatus[1] == 0)
				        {
				            MoveDynamicObject(b1AutoGate[2], -6161.04492188,1726.78503418,-4.14656250, 2);
                            b1AutoGateStatus[1] = 1; // open
						}
					}
				}
			// Closing Gates..
				if(IsPlayerInRangeOfPoint(i, 4.0, -6147.2759,1737.2760,1.8192))
				{
				    if(IsPlayerInAnyVehicle(i))
				    {
				        if(b1AutoGateStatus[0] == 1)
				        {
				            MoveDynamicObject(b1AutoGate[0], -6160.70507812,1734.60412598,1.14656250, 2);
				            MoveDynamicObject(b1AutoGate[1], -6160.37255859,1740.00256348,1.14656250, 2);
                            b1AutoGateStatus[0] = 0; // open
						}
					}
				}
				if(IsPlayerInRangeOfPoint(i, 4.0, -6169.5713,1725.5347,2.1466))
				{
				    if(IsPlayerInAnyVehicle(i))
				    {
				        if(b1AutoGateStatus[1] == 1)
				        {
				            MoveDynamicObject(b1AutoGate[2], -6161.04492188,1726.78503418, 1.14656250, 2);
                            b1AutoGateStatus[1] = 0; // open
						}
					}
				}
			} // ----------------------------------- end of admin level 3
			#endif
			
		}
	}
	return 1;
}

forward GlobalHackCheck();
public GlobalHackCheck()
{
	/*
	 *      (fuck a) DUCK anticheat v1.0
	 *              by Luk0r & Alex_Raven
	 *
	 *  This function is called every second the check each
	 *  player's money/weapons to ensure they're not hacking // Doesn't check the money, idk how to do that since we have no scripted moneys
	 */

	new curHour, curMinute, curSecond;
	new string[128], plname[64];
	new weaponid, ammo;
	//new hacking;
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i) && PlayerInfo[i][Level] < 2)
	    {
			gettime(curHour, curMinute, curSecond);

			new pSpecialAction = GetPlayerSpecialAction(i);
			if (pSpecialAction == SPECIAL_ACTION_USEJETPACK && AdminGaveMeIt[i] == 0)
			{
				// Illegal weapon
				TogglePlayerControllable(i, 0);
				for(new j = 0; j < 50; j++) SendClientMessage(i,green," ");
				SendBanMsg(i, i, "Jetpack Hack");
				//OnPlayerUpdate(i);
				//GetPlayerIp(i, banip, sizeof(banip));
				//BanAdd(4, PlayerInfo[i][pSQLID], banip, 38);
                GetPlayerName(i, plname, sizeof(plname));
				new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second);
                format(string,sizeof(string),"%s has been banned by iBan Anticheat: Jetphax [Date: %d/%d/%d] [Time: %d:%d]",plname,day,month,year,hour,minuite);
                MessageToAdmins(red,string);

                SaveToFile("BanLog",string);
				print(string);

				GetPlayerName(i, plname, sizeof(plname));
				format(string, sizeof(string), " %s was banned by iBan™ for: Jetphax", plname);
				SendClientMessageToAll(COLOR_ORANGE, string);

				if(udb_Exists(PlayerName2(i)) && PlayerInfo[i][LoggedIn] == 1) dUserSetINT(PlayerName2(i)).("banned",1);
				Kick(i);
			}
            GetPlayerWeaponData(i, 6, weaponid, ammo);
			if(weaponid == 33 && AdminGaveMeIt[i] == 0)
            {
  	            GetPlayerName(i, plname, sizeof(plname));
				format(string, sizeof(string), " %s was banned by iBan for: Weapon Chitz [Rifle]", plname);
				SendClientMessageToAll(COLOR_ORANGE, string);

				TogglePlayerControllable(i, 0);
                for(new j = 0; j < 50; j++) SendClientMessage(i, green," ");
				SendBanMsg(i, i, "Weapon Hacks (Rifle)");
				//OnPlayerUpdate(i);
				//GetPlayerIp(i, banip, sizeof(banip));
				//BanAdd(4, PlayerInfo[i][pSQLID], banip, 38);
                GetPlayerName(i, plname, sizeof(plname));
				new year,month,day,hour,minuite,second; getdate(year, month, day); gettime(hour,minuite,second);
                format(string,sizeof(string),"%s has been banned by iBan Anticheat: Rifle in pocket [Date: %d/%d/%d] [Time: %d:%d]",plname,day,month,year,hour,minuite);
                MessageToAdmins(red,string);

                SaveToFile("BanLog",string);
				print(string);

				if(udb_Exists(PlayerName2(i)) && PlayerInfo[i][LoggedIn] == 1) dUserSetINT(PlayerName2(i)).("banned",1);
				Kick(i);
			}
		}
	}
}

forward PlayerTaxiTimer(playerid);
public PlayerTaxiTimer(playerid)
{
    PlayerTaxi[playerid]= 0;
    return 1;
}

public SetPlayerRandomSpawn(playerid)
{
    Spawned2[playerid] = 1;
	if (iSpawnSet[playerid] == 0)
    {
		new rand = random(sizeof(gRandomPlayerSpawns));
		SetPlayerPos(playerid, gRandomPlayerSpawns[rand][0], gRandomPlayerSpawns[rand][1], gRandomPlayerSpawns[rand][2]); // Warp the player
	}
	return 1;
}
/*
forward RandomAnim(playerid);
public RandomAnim(playerid)
{
	SetPlayerSpecialAction(playerid,roflwtfbbq[random(sizeof(roflwtfbbq))][0]);
}
*/
forward PlaySoundForAll(soundid);
public PlaySoundForAll(soundid)
{
	for(new i; i<MAX_PLAYERS; i++)
	   if(IsPlayerConnected(i)) PlayerPlaySound(i,soundid,0.0,0.0,0.0);
}


forward HandOfGodHim(playerid);
public HandOfGodHim(playerid)
{
    new Float:X,Float:Y,Float:Z;
    GetPlayerPos(playerid,X,Y,Z);
    SetPlayerPos(playerid,X,Y,Z+300);
    CreateExplosion(X,Y,Z+250,7,12);
	SetPlayerVelocity(playerid, 0.0, 0.0, -100.0);
	return 1;
}

forward PenisTimer(playerid);
public PenisTimer(playerid)
{
    SlapMeHarder[playerid]= 0;
    return 1;
}

public VehicleTimerHealth(playerid)
{
        if(!IsPlayerInAnyVehicle(playerid)) return false;
        if(IsGameOn)
        {
            SetVehicleHealth((GetPlayerVehicleID(playerid)),100);
            SendClientMessage(playerid,red,"Burn Baby Burn!");
            SetTimerEx("VehicleTimerHealth",30*1000,false,"i",playerid);
            return false;
        }
        KillTimer(0);
        return true;
}
forward DuelDialogTimeout(playerid);
public DuelDialogTimeout(playerid)
{
	new string[128];
	HidePlayerDialog(playerid);
	format(string, sizeof(string), "* You failed to accept or decline in time and the dueal request from %s has been cancelled.", pName(PlayerInfo[playerid][DuelFrom]));
	SendClientMessage(playerid, Red, string);
	format(string, sizeof(string), "* %s did not answer your request for a duel in time.", pName(playerid));
	SendClientMessage(PlayerInfo[playerid][DuelFrom], Red, string);
	GivePlayerMoney(PlayerInfo[playerid][DuelFrom], 15000);
	PlayerInfo[PlayerInfo[playerid][DuelFrom]][DuelTo] = INVALID_PLAYER_ID;
	PlayerInfo[playerid][DuelFrom] = INVALID_PLAYER_ID;
	PlayerInfo[playerid][IsInDuel] = 0;
	PlayerInfo[PlayerInfo[playerid][DuelFrom]][IsInDuel] = 0;
	return 1;
}

forward SpawnTimer(playerid);
public SpawnTimer(playerid)
{
   if(SpawnArmourBought[playerid] == 1)
   {
	  SetPlayerHealth(playerid,100.0);
	  SetPlayerArmour(playerid,100.0);
	  IsSpawning[playerid] = 0;
   }
   if(SpawnArmourBought[playerid] == 0)
   {
      SetPlayerHealth(playerid,100.0);
	  SetPlayerArmour(playerid,0);
	  IsSpawning[playerid] = 0;
   }
   for(new iWeaponID; iWeaponID < 50; iWeaponID++)
   {
      if(iPlayerSpawnWeapon[playerid][iWeaponID] > 0)
      GivePlayerWeapon(playerid,iWeaponID,iPlayerSpawnWeapon[playerid][iWeaponID]);
   }
   GivePlayerWeapon(playerid,24,150);
   return 1;
}

forward RegularPlayer();
public RegularPlayer()
{
   new string3[128];
   new year,month,day,hour,minuite; getdate(year, month, day); gettime(hour,minuite);
   format(string3,sizeof(string3),"[UPDATE] Regular players updated.[Date: %d/%d/%d] [Time: %d:%d]",day,month,year,hour,minuite);
   MessageToAdmins(red,string3);
   print(string3);
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
      if(PlayerInfo[i][hours] >= 30 && IsPlayerConnected(i) && PlayerInfo[i][Regular] == 0) {
           new string[128];
           format(string,sizeof(string),"%s has reached 30 hours and is now a regular player!",PlayerName2(i));
           SendClientMessageToAll(COLOR_ORANGE,string);
           dUserSetINT(PlayerName2(i)).("Regular",1);
           return 1;
      }
      if(PlayerInfo[i][Regular] == 1 && PlayerInfo[i][Level] < 2 && IsPlayerConnected(i)) {
          new string2[128];
          format(string2,sizeof(string2),"You have earned $50,000 for being a regular player",PlayerName2(i));
		  SendClientMessage(i,MANAGEMENT,string2); GivePlayerMoney(i,50000);
		  return 1;
	  }
   }
   return 1;
}

forward AutoRepair();
public AutoRepair()
{
	for(new i=0; i < MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i) && PlayerInfo[i][LoggedIn])
	    {
	        if(PlayerInfo[i][AutoFix])
	        {
	            if(IsPlayerInAnyVehicle(i))
	            {
					RepairVehicle(GetPlayerVehicleID(i));
				}
			}
		}
	}
	return 1;
}

forward PlayerOnShip(); // WHY THE FUCK DOESN'T THIS SHIT WORK
public PlayerOnShip()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
		if(IsPlayerConnected(i) && PlayerInfo[i][Level] < 2)
		{
            if(IsPlayerInAreaa(i, 810.3149,820.8247,-1109.3395,-1091.6564))
			{
                if(IsPlayerInAnyVehicle(i))
				{
                    new car = GetPlayerVehicleID(i);
                    SetVehicleToRespawn(car);
                    SendClientMessage(i,red,"Error: No vehicles allowed on the ship!");
                }
			}
	    }
    }
    return 1;
}
/*
stock SaveProperties()
{
	new entry[128];
	new File: propfile = fopen("lsx/PropertySystem/PropertyInfo.txt", io_write);
	for(new id; id<PropertiesAmount; id++)
	{
	    format(entry, 128, "%s,%.2f,%.2f,%.2f,%d,%d,%s,%d,%d \r\n",PropInfo[id][PropName], PropInfo[id][PropX], PropInfo[id][PropY], PropInfo[id][PropZ], PropInfo[id][PropValue], PropInfo[id][PropEarning], PropInfo[id][PropOwner], PropInfo[id][PropIsBought], PropInfo[id][PropUnbuyableTime]);
		fwrite(propfile, entry);
	}
	printf("Saved %d Properties!", PropertiesAmount);
	fclose(propfile);
}
*/
// ------------------------------ Hitman shit --------------------------------//
StartHitman()
{
        new id = GetRandomID();
        IsGameOn = 1;
        GameTextForAll("~w~Kill the ~r~red~w~ player!",5000,1);
        format(lolz,128,"The Anti-Terrorism Unit has identified %s as a risk to national security",PlayerName3(id));
        SendClientMessageToAll(red,lolz);
        SendClientMessageToAll(red,"and is wanted dead!");
        format(lolz,128,"Whoever kills %s will claim the $%d reward.",PlayerName3(id),CASH_PRIZE);
        SendClientMessageToAll(red,lolz);
        ResetPlayerWeapons(id);
        SetPlayerArmour(id,100);
        SetPlayerHealth(id,100);
        SetPlayerColor(id,red);
        PlayerHitman[id] = true;
        SetTimerEx("VehicleTimerHealth",30*1000,false,"i",id);
		for(new i =0; i <MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
                colorp[i] = GetPlayerColor(i);
                PlayCrimeReportForPlayer(i,id,17);
                SetPlayerColor(i,MAD_WHITE);
                GivePlayerWeapon(i,WEAPON_ID,WEAPON_AMMO);
			}
        }
}

EndHitman()
{
        KillTimer(0);
        IsGameOn = 0;
        for(new i =0; i <MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
            {
            	SetPlayerColor(i,colorp[i]);
            	PlayerHitman[i] = false;
            	ResetPlayerWeapons(i);
            	SetTimerEx("SpawnTimer",1000,false,"i",i);
			}
        }
}

stock GetRandomID() //thanks to Boylett
{
        new bool:connected[MAX_PLAYERS] = false, amount = 0;
        for(new i = 0; i < MAX_PLAYERS; i++)
            if(IsPlayerConnected(i))
            {
                connected[i] = true;
                amount++;
            }
        if(amount == 0) return -1;
        new rand = random(amount), done = 0;
        for(new i = 0; i < MAX_PLAYERS; i++)
            if(connected[i])
            {
                if(done == rand) return i;
                done++;
           	}
        return -1;
}

stock PlayerName3(playerid)
{
  new name[MAX_PLAYER_NAME];
  GetPlayerName(playerid, name, 255);
  return name;
}

forward split(const strsrc[], strdest[][], delimiter);
public split(const strsrc[], strdest[][], delimiter)
{
	new i, li;
	new aNum;
	new len;
	while(i <= strlen(strsrc)){
	    if(strsrc[i]==delimiter || i==strlen(strsrc)){
	        len = strmid(strdest[aNum], strsrc, li, i, 128);
	        strdest[aNum][len] = 0;
	        li = i+1;
	        aNum++;
		}
		i++;
	}
	return 1;
}

stock CountProperties()
{
    new entry[128];
	new File: propfile = fopen("lsx/PropertySystem/PropertyInfo.txt", io_read);
	while(fread(propfile, entry, 128))
	{
		PropertiesAmount++;
  	}
  	fclose(propfile);
}

// Countdown
stock CreateCountdown(time, sound)
{
	if(IsCountdownStarted == 0)
	{
	    for(new i; i<MAX_PLAYERS; i++)
	    {
	        if(IsPlayerConnected(i))
	        {
		        if(IsPlayerCountdownStarted[i] == 1)
		        {
		            KillTimer(PlayerCountdownTimer[i]);
		            PlayerCountdownCount[i] = 0;
		            IsPlayerCountdownStarted[i] = 0;
				}
			}
		}
		CountdownTimer = SetTimerEx("Countdown", 1000, 1, "d", sound);
		CountdownCount = time;
		IsCountdownStarted = 1;
	}
}
stock CreatePlayerCountdown(playerid, time, sound)
{
	if(IsPlayerCountdownStarted[playerid] == 0 && IsCountdownStarted == 0)
	{
		PlayerCountdownTimer[playerid] = SetTimerEx("PlayerCountdown", 1000, 1, "id", playerid, sound);
		PlayerCountdownCount[playerid] = time;
		IsPlayerCountdownStarted[playerid] = 1;
	}
}
stock StopCountdown()
{
	KillTimer(CountdownTimer);
	GameTextForAll(" ", 10, 3);
    CountdownCount = 0;
    IsCountdownStarted = 0;
}
stock StopPlayerCountdown(playerid)
{
	KillTimer(PlayerCountdownTimer[playerid]);
	GameTextForPlayer(playerid, " ", 10, 3);
    PlayerCountdownCount[playerid] = 0;
    IsPlayerCountdownStarted[playerid] = 0;
}


forward Countdown(sound);
public Countdown(sound)
{
    if(CountdownCount == 0)
	{
	    if(sound == 1)
		{
		    for(new i; i<MAX_PLAYERS; i++)
		    {
		        if(IsPlayerConnected(i))
		        {
		            PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
				}
			}
		}
	    GameTextForAll("~r~GoGoGo", 2000, 3);
	    KillTimer(CountdownTimer);
	    IsCountdownStarted = 0;
	}
	else
	{
	    if(sound == 1)
		{
		    for(new i; i<MAX_PLAYERS; i++)
		    {
		        if(IsPlayerConnected(i))
		        {
		            PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
				}
			}
		}
		new cdstring[128];
		format(cdstring, sizeof(cdstring), "~y~%d", CountdownCount);
		GameTextForAll(cdstring, 1500, 3);
		CountdownCount--;
	}
}

forward PlayerCountdown(playerid, sound);
public PlayerCountdown(playerid, sound)
{
    if(PlayerCountdownCount[playerid] == 0)
	{
	    if(sound == 1) PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
	    GameTextForPlayer(playerid,"~n~~n~~r~GoGoGo", 2000, 3);
	    KillTimer(PlayerCountdownTimer[playerid]);
	    IsPlayerCountdownStarted[playerid] = 0;
	}
	else
	{
	    if(sound == 1) PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
		new pcdstring[128];
	    format(pcdstring, sizeof(pcdstring), "~n~~g~%d", PlayerCountdownCount[playerid]);
		GameTextForPlayer(playerid, pcdstring, 1500, 3);
		PlayerCountdownCount[playerid]--;
	}
}

/*
forward IsPlayerNearProperty(playerid);
public IsPlayerNearProperty(playerid)
{
	new Float:Distance;
	for(new prop; prop<PropertiesAmount; prop++)
	{
	    Distance = GetDistanceToProperty(playerid, prop);
	    if(Distance < 1.0)
	    {
	        return prop;
		}
	}
	return -1;
}
*/
forward Float:GetDistanceToProperty(playerid, Property);
public Float:GetDistanceToProperty(playerid, Property)
{
	new Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2;
	GetPlayerPos(playerid,x1,y1,z1);
	x2 = PropInfo[Property][PropX];
	y2 = PropInfo[Property][PropY];
	z2 = PropInfo[Property][PropZ];
	return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}

stock GetPlayerID(const Name[])
{
	for(new i; i<MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
	        new pName2[MAX_PLAYER_NAME];
			GetPlayerName(i, pName2, sizeof(pName2));
	        if(strcmp(Name, pName2, true)==0)
	        {
	            return i;
			}
		}
	}
	return -1;
}

stock MessageToAdminsEx(exception, color, const string[])
{
	for(new i; i<MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) && PlayerInfo[i][Level] >= 3)
		{
			if(i != exception)
			{
			    new str[128];
				format(str, sizeof(str), " %s", string);
				SendClientMessage(i, color, string);
			}
		}
	}
	return 1;
}

forward UpdateUnbuyableTime();
public UpdateUnbuyableTime()
{
	for(new propid; propid<PropertiesAmount; propid++)
	{
	    if(PropInfo[propid][PropIsBought] == 1)
	    {
			if(PropInfo[propid][PropUnbuyableTime] > 0)
			{
	        	PropInfo[propid][PropUnbuyableTime]--;
			}
		}
	}
}

stock encodepass(buf[])
{
	new length=strlen(buf);
    new s1 = 1;
    new s2 = 0;
    new n;
    for (n=0; n<length; n++)
    {
       s1 = (s1 + buf[n]) % 65521;
       s2 = (s2 + s1)     % 65521;
    }
    return (s2 << 16) + s1;
}

forward PropertyPayout();
public PropertyPayout()
{
	new str[64];
	for(new i; i<MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i))
	    {
	        if(PlayerProps[i] > 0)
	        {
	            GivePlayerMoney(i, EarningsForPlayer[i]);
				format(str, 64, "* You earned $%d from your %d properties!", EarningsForPlayer[i], PlayerProps[i]);
				SendClientMessage(i, MAD_WHITE, str);
			}
		}
	}
}

IsPlayerInAreaa(playerid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
   new Float:x, Float:y, Float:z;
   GetPlayerPos(playerid, x, y, z);
   if (x > minx && x < maxx && y > miny && y < maxy) return 1;
   return 0;
}

public SendPlayerFormattedText(playerid, const str[], define)
{
	new tmpbuf[128];
	format(tmpbuf, sizeof(tmpbuf), str, define);
	SendClientMessage(playerid, 0x008040FF, tmpbuf);
}

public settime(playerid)
{
	new hour,minute,second, string[128];
	gettime(hour,minute,second);
	if(minute <= 9)
	{
 		format(string,25,"%d:0%d",hour,minute);
		if(PlayerInfo[playerid][MyTime] == 0)
		{
			SetPlayerTime(playerid, hour, minute);
		}
		else if(PlayerInfo[playerid][MyTime] == 1 && PlayerInfo[playerid][MyHour] != -1)
		{
		    SetPlayerTime(playerid, PlayerInfo[playerid][MyHour],0);
		}
	}
	else
	{
 		format(string,25,"%d:%d",hour, minute);
		if(PlayerInfo[playerid][MyTime] == 0)
		{
			SetPlayerTime(playerid, hour, minute);
		}
		else if(PlayerInfo[playerid][MyTime] == 1 && PlayerInfo[playerid][MyHour] != -1)
		{
		    SetPlayerTime(playerid, PlayerInfo[playerid][MyHour],0);
		}
	}
	TextDrawSetString(Clock,string);
	//SetWorldTime(hour);
}
/*	new day, month, year;
	new weekday;
	getdate(day, month, year);
	weekday = GetWeekdayNum(day, month, year);
	if(weekday == 0){TextDrawSetString(WeekDayg,"Sunday");}
	if(weekday == 1){TextDrawSetString(WeekDayg,"Monday");}
	if(weekday == 2){TextDrawSetString(WeekDayg,"Tuesday");}
	if(weekday == 3){TextDrawSetString(WeekDayg,"Wednesday");}
	if(weekday == 4){TextDrawSetString(WeekDayg,"Thursday");}
	if(weekday == 5){TextDrawSetString(WeekDayg,"Friday");}
	if(weekday == 6){TextDrawSetString(WeekDayg,"Saturday");}
	return 1;


public GetWeekdayNum(d,m,y) //by d.wine
{
	m-=2;
	if(m<=0)
		{
		y--;
		m+=12;
		}
	new cen = y/100;
	y=getrem(y,100);
	new w = d + ((13*m-1)/5) + y + (y/4) + (cen/4) - 2*cen;
	w=getrem(w,6);
	if (w==0) w=6;
	return w-1;
}


getrem(a,b) //get remnant of division
{
	new div2 = a/b;
	new left = a-b*div2;
	return left;
}
*/

public AFKick(playerid)
{
	#if AFK_KICK_ENABLED
	if(!IsPlayerConnected(playerid)) return 1;
	GetPlayerPos(playerid, AFKPos[playerid][0], AFKPos[playerid][1], AFKPos[playerid][2]);
	if(AFKPos[playerid][0] == AFKPos[playerid][3] && AFKPos[playerid][1] == AFKPos[playerid][4] && AFKPos[playerid][2] == AFKPos[playerid][5])
	{
	    new player[MAX_PLAYER_NAME], string[128];
	    GetPlayerName(playerid, player, sizeof(player));
	    format(string, sizeof(string), "*** %s was automatically kicked from the server. (Idling)", player);
	    SendClientMessageToAllEx(playerid, COLOR_ORANGE, string);
	    print(string);
	    for(new i = 0; i < 50; i++) SendClientMessage(playerid, green," ");
        new hour,minuite; gettime(hour,minuite);
	    SendClientMessage(playerid, red, "=====================");
        format(string,sizeof(string),"You have been automatically kicked for idling [Time: %d:%d]",hour,minuite);
	    SendClientMessage(playerid, red,string);
	    SendClientMessage(playerid, red, "=====================");
		TogglePlayerControllable(playerid, 0);
		Kick(playerid);
		return 1;
	}
	AFKPos[playerid][3] = AFKPos[playerid][0];
	AFKPos[playerid][4] = AFKPos[playerid][1];
	AFKPos[playerid][5] = AFKPos[playerid][2];
	return 1;
	#endif
}

public PlayerDiveCardiveTimer(playerid)
{
	PlayerDive[playerid]=0;PlayerCardive[playerid]=0;
	return 1;
}

public PlayerTpCtpTimer(playerid)
{
	PlayerTp[playerid]=0;PlayerCtp[playerid]=0;
	return 1;
}

public PlayerGivecashTimer(playerid)
{
	PlayerGivecash[playerid]=0;
	return 1;
}

stock SetMapIcons(playerid){

	SetPlayerMapIcon(playerid, 0, 2003.3196,1544.8306,13.5908, 56, 0xFFFFFFFF); // Yellow blip at the ship
	SetPlayerMapIcon(playerid, 1, 596.4222,-1262.4955,64.1875, 52, 0xFFFFFFFF); // Dollar symbol at bank
	SetPlayerMapIcon(playerid, 2, 1396.395,2769.056, 15.0000, 23, 0xFFFFFFFF);  // Deadhead at the gangbase
	SetPlayerMapIcon(playerid, 3, 1219.3269,-1812.5309,16.5938, 55, 0xFFFFFFFF); // Licence Centre
	SetPlayerMapIcon(playerid, 4, 1568.5198,-1247.8176,277.8783, 56, 0xFFFFFFFF); // Admin Lounge
}

forward PlayerLeaveGang(playerid);
public PlayerLeaveGang(playerid)
{
	new string[128];
	new playername[MAX_PLAYER_NAME];
	new gangnum = playerGang[playerid];

    if(gangnum > 0)
	{
		for(new i = 0; i < gangInfo[gangnum][1]; i++)
		{
			if(gangMembers[gangnum][i]==playerid)
			{

			    //One less gang member
			    gangInfo[gangnum][1]--;

      		    for(new j = i; j < gangInfo[gangnum][1]; j++)
				{
				    //Shift gang members
				    gangMembers[gangnum][j]=gangMembers[gangnum][j+1];
	    		}

			    //Disband gang if no more members
			    if(gangInfo[gangnum][1]<1)
				{
			        gangInfo[gangnum][0]=0;
			        gangInfo[gangnum][1]=0;
			        gangBank[gangnum]=0;
       			}

				//Notify other members
				for(new j = 0; j < gangInfo[gangnum][1]; j++)
				{
				    GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
					format(string, sizeof(string),"%s has quit your gang.", playername);
					SendClientMessage(gangMembers[gangnum][j], COLOR_ORANGE, string);
				}

				format(string, sizeof(string),"You have quit the gang '%s' (id: %d)", gangNames[gangnum], gangnum);
				SendClientMessage(playerid, COLOR_ORANGE, string);

				playerGang[playerid]=0;
/*				if(PlayerInfo[playerid][Registered] != 1)
				{
				    SetPlayerColor(playerid, White);
				}
				else
				{
					SetPlayerColor(playerid,RandomColors[playerid]);
				}
*/
				return;
			}
		}
	}
	else
	{
		SendClientMessage(playerid, Red, "You are not in a gang.");
	}
}

public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
	if(checkpointid == Export_CP)
	{
	    CExport__OnEnterCheckpoint(playerid);
	}
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
    if(PlayerToPoint(7.0,playerid,2131.2141,-1147.5479,24.1365))
	{
        if(IsPlayerInVehicle(Gamecar[playerid], WantedCar))
		{
            new str[128], Float:vHealth;
            GetVehicleHealth(WantedCar,vHealth);
            if(vHealth < 650)
            {
                SendClientMessage(playerid, MANAGEMENT, ""COL_LIGHTBLUE"DVLA: "COL_WHITE"This car is damaged! The impound only paid you half!");
                GivePlayerMoney(Gamecar[playerid],CASH_MONET/2 - random(5000));
                format(str, sizeof(str), ""COL_LIGHTBLUE"DVLA: "COL_WHITE"%s has returned the vehicle to the impound damaged and was rewarded with $%d!", PlayerName2(playerid), CASH_MONET/2 - random(5000));
			}
			else
			{
			    GivePlayerMoney(Gamecar[playerid],CASH_MONET);
			    format(str, sizeof(str), ""COL_LIGHTBLUE"DVLA: "COL_WHITE"%s has returned the vehicle to the impound and was rewarded with $%d!", PlayerName2(playerid), CASH_MONET);
			}
            DestroyVehicle(WantedCar);
            SendClientMessageToAll(DAYTONA_YELLOW,str);
            Gamecar[playerid] = INVALID_PLAYER_ID;
            WantedCar = INVALID_VEHICLE_ID;
            WantedGameOn = 0;
            for(new i=0; i<MAX_PLAYERS; i++)
            {
                if(IsPlayerConnected(i))
                {
            		DisablePlayerCheckpoint(playerid);
				}
			}
            EndFuckingGame(playerid);
		} else return SendClientMessage(playerid, red, ""COL_LIGHTBLUE"DVLA: "COL_WHITE"Where's the car, fool?! No car - no money!");
	}
	if(PlayerToPoint(1.0,playerid,1173.2203,1350.9459,10.9219))
	{
		IsInCheckPoint[playerid] = 1;
	}
	if(PlayerToPoint(5.0,playerid,1292.5637,4.7473,1001.0104))
	{
		SetPlayerInterior(playerid,0);
		if(IsPlayerInAnyVehicle(playerid))
		{
			new car = GetPlayerVehicleID(playerid);
			LinkVehicleToInterior(car,0);
			SetVehiclePos(car,1585.5562,-1414.5807,13.2807);
			SetVehicleZAngle(car,270);
			SendClientMessage(playerid,MANAGEMENT,"** Exited storage warehouse. Enjoy the ride.");
			DisablePlayerCheckpoint(playerid);
			return 1;
		}
		SetPlayerPos(playerid,1585.5562,-1414.5807,13.2807);
		SetPlayerFacingAngle(playerid,270);
		SendClientMessage(playerid,MANAGEMENT,"** Exited storage warehouse.");
		DisablePlayerCheckpoint(playerid);
	}
	if(PlayerToPoint(2.0,playerid,2316.2214,-7.5546,26.7422))
	{

		if(PlayerInfo[playerid][xAccount] < 1)
		{
		    SendClientMessage(playerid,MANAGEMENT,"Type \"/account upgrade\" to upgrade to an xAccount");
		}
		InBankCheckpoint[playerid] = 1;
	}
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
    IsInCheckPoint[playerid] = 0;
    InBankCheckpoint[playerid] = 0;
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
   return 1;
}

forward IsPlayerAdminCall(playerid);
public IsPlayerAdminCall(playerid)
	return (PlayerInfo[playerid][Level] >= 2);

NowAFK(playerid)
{

	GetPlayerPos(playerid, AfkPosi[playerid][0], AfkPosi[playerid][1], AfkPosi[playerid][2]);

	new lolzite[12];

	new posz = 0;
	for(new i=0; i<MAX_PLAYERS; i++)
	{
	    if(IsPlayerConnected(i) && afkdude[i] == 1)
		{
	        lolzite[Positionofdude[i]] = 1;
  		}
	}

	for(new i=11; i>-1; i--)
	{
	    if(lolzite[i] == 0)
		{
	        posz = i;
  		}
	}

	SetPlayerPos(playerid, AFKPosition[posz][0], AFKPosition[posz][1], AFKPosition[posz][2]);
	SetPlayerFacingAngle(playerid, AFKPosition[posz][3]);
	SetCameraBehindPlayer(playerid);

    TogglePlayerControllable(playerid, 0);

	afkdude[playerid] = 1;
	Positionofdude[playerid] = posz;
	return 1;
}

NowBack(playerid)
{

	afkdude[playerid] = 0;
	Positionofdude[playerid] = -1;

	TogglePlayerControllable(playerid, 1);
	SetPlayerPos(playerid,AfkPosi[playerid][0], AfkPosi[playerid][1], AfkPosi[playerid][2]);

    AfkPosi[playerid][0] = 0.0;
	AfkPosi[playerid][1] = 0.0;
	AfkPosi[playerid][2] = 0.0;
	SetCameraBehindPlayer(playerid);

	return 1;
}

forward GlobalStatsSave();
public GlobalStatsSave()
{
	for(new p = 0; p < MAX_PLAYERS; p++)
	{
	    if(IsPlayerConnected(p) && PlayerInfo[p][LoggedIn] == 1 && PlayerInfo[p][Registered] == 1)
	    {
	        SavePlayer(p);
	        SendClientMessage(p, MANAGEMENT, "{CAE1FF}StatsServ:{0E8C3A} Your statistics have been automatically saved.");
		 	print("Globals Statistics saved for all connected players.");
		}
	}
	return 1;
}

forward SpeedHack();
public SpeedHack()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
	    {
            if(GetPlayerState(i) == 2)
            {
                GetPlayerPos(i, TelePos[i][3], TelePos[i][4], TelePos[i][5]);
                if(TelePos[i][5] > 550.0)
                {
                    TelePos[i][0] = 0.0;
                    TelePos[i][1] = 0.0;
                }
                if(TelePos[i][0] != 0.0)
                {
                    new Float:maxspeed = 175.0;
                    new plname[MAX_PLAYER_NAME];
	                new string[128];
	                new Float:xdist = TelePos[i][3]-TelePos[i][0];
				    new Float:ydist = TelePos[i][4]-TelePos[i][1];
                    new Float:sqxdist = xdist*xdist;
                    new Float:sqydist = ydist*ydist;
                    new Float:distance = (sqxdist+sqydist)/31;
                    if(distance > maxspeed)// && PlayerInfo[i][Level] < 2)
                    {
						new car = GetPlayerVehicleID(i);
						new carid = GetVehicleModel(car);
                        if(carid == 460 || carid == 464 || carid == 476 || carid == 511 || carid == 512 || carid == 513 || carid == 519 || carid == 520 || carid == 553 || carid == 577 || carid == 592 || carid == 593) return 1;
                        GetPlayerName(i, plname, sizeof(plname));
                        format(string, 128, "Admin Message: [%d]%s was clocked travelling %.0f mph. Max speed is set to: %.0f",i,plname,distance, maxspeed);
                        MessageToAdmins(MAD_WHITE,string);
                    }
				}
                if(TelePos[i][5] < 550.0 && TelePos[i][3] != 0.0)
				{
					TelePos[i][0] = TelePos[i][3];
					TelePos[i][1] = TelePos[i][4];
				}
            }
        }
    }
    return 1;
}

stock IsPlayerInCube( PlayerID, Float:MinX, Float:MaxX, Float:MinY, Float:MaxY, Float:MinZ=-99999.0, Float:MaxZ=99999.9 )
{
	// Checks if the player is inside the cube specified.

	new Float:pX, Float:pY, Float:pZ;

	GetPlayerPos(PlayerID, pX, pY, pZ);

	if (pX > MinX && pX < MaxX && pY > MinY && pY < MaxY && pZ > MinZ && pZ < MaxZ) return 1;
	else return 0;
}



forward MathOn();
public MathOn()
{
	new str[254];
	if(MathGameOn == 0)
	{
		MathGameOn = 1;
		new sum1 = random(400);
		new sum2 = random(300);
		new sum3 = random(200);
		new sum41 = random(2);

		if(sum41 == 0)
		{
			answer = sum1 + sum2 - sum3;
			format(str,sizeof(str), "Numb3rz: The first person to answer wins $20,000. %d + %d - %d = ?", sum1, sum2, sum3);
			SendClientMessageToAll(MAD_WHITE,str);
			DopeTimer = SetTimer("MathOff",120000, false);
		}
		else if(sum41 == 1)
		{
			answer = sum1 - sum2 + sum3;
			format(str,sizeof(str), "Numb3rz: The first person to answer wins $20,000. %d - %d + %d = ?", sum1, sum2, sum3);
			SendClientMessageToAll(MAD_WHITE,str);
			DopeTimer = SetTimer("MathOff",120000, false);
		}
	}
	return 1;
}

forward MathOff();
public MathOff()
{
	MathGameOn = 0;
	KillTimer(DopeTimer);
	SetTimer("MathOn",300000,false);
	return 1;
}

LoadStaticVehiclesFromFile(const filename[])
{
	new File:file_ptr;
	new line[128];
	new var_from_line[64];
	new vehicletype;
	new Float:SpawnX;
	new Float:SpawnY;
	new Float:SpawnZ;
	new Float:SpawnRot;
	new Color1, Color2;
	new index;
	new vehicles_loaded;

	file_ptr = fopen(filename,filemode:io_read);
	if(!file_ptr) return 0;

	vehicles_loaded = 0;

	while(fread(file_ptr,line,128) > 0)
	{
	    index = 0;

	    // Read type
  		index = token_by_delim(line,var_from_line,',',index);
  		if(index == (-1)) continue;
  		vehicletype = strval(var_from_line);
   		if(vehicletype < 400 || vehicletype > 611) continue;

  		// Read X, Y, Z, Rotation
  		index = token_by_delim(line,var_from_line,',',index+1);
  		if(index == (-1)) continue;
  		SpawnX = floatstr(var_from_line);

  		index = token_by_delim(line,var_from_line,',',index+1);
  		if(index == (-1)) continue;
  		SpawnY = floatstr(var_from_line);

  		index = token_by_delim(line,var_from_line,',',index+1);
  		if(index == (-1)) continue;
  		SpawnZ = floatstr(var_from_line);

  		index = token_by_delim(line,var_from_line,',',index+1);
  		if(index == (-1)) continue;
  		SpawnRot = floatstr(var_from_line);

  		// Read Color1, Color2
  		index = token_by_delim(line,var_from_line,',',index+1);
  		if(index == (-1)) continue;
  		Color1 = strval(var_from_line);

  		index = token_by_delim(line,var_from_line,';',index+1);
  		Color2 = strval(var_from_line);

  		//printf("%d|%f|%f|%f|%f|%d|%d",vehicletype,
  		    //SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2);

		AddStaticVehicleEx(vehicletype,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2,-1);

		vehicles_loaded++;
	}

	fclose(file_ptr);
	printf("Loaded %d vehicles from: %s",vehicles_loaded,filename);
	return vehicles_loaded;
}

// Tokenise by a delimiter
// Return string and index of the end determined by the
// provided delimiter in delim
token_by_delim(const string[], return_str[], delim, start_index)
{
	new x=0;
	while(string[start_index] != EOS && string[start_index] != delim) {
	    return_str[x] = string[start_index];
	    x++;
	    start_index++;
	}
	return_str[x] = EOS;
	if(string[start_index] == EOS) start_index = (-1);
	return start_index;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
/*    if(WantedGameOn == 1)
	{
    	SetVehicleParamsForPlayer(WantedCar,forplayerid, 1, 0);
	} */
 	if(PlayerInfo[forplayerid][Licence] == 1)
 	{
  		SetVehicleParamsForPlayer(WantedCar,forplayerid, 0, 0);
    } else {
    	SetVehicleParamsForPlayer(WantedCar,forplayerid, 0, 1);
    }
    SetVehicleParamsForPlayer(vehicleid, forplayerid, VehicleStr[vehicleid][forplayerid][c], VehicleStr[vehicleid][forplayerid][l]);
    return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

forward irdrunk();
public irdrunk()
{
	for(new i; i<MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i) && GetPlayerDrunkLevel(i) >= 4000)
		{
            ApplyAnimation(i,"PED","WALK_DRUNK",4.1,1,1,1,1,1);
            return 1;
		}
		if(IsPlayerConnected(i) && GetPlayerDrunkLevel(i) >= 20000)
		{
		    SetPlayerHealth(i, 0);
		    return 1;
		}
	}
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
    new str2[128];
    if(!success) //If the password was incorrect
    {
        new pip[16], str[128];
        for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
        {
			GetPlayerIp(i, pip, sizeof(pip));
  			if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
  			{
  				format(str,sizeof(str),"Admin Message: Attempted RCON login from: %s[IP:%s] using wrong password: %s", pName(i),ip, password);
				format(str2,sizeof(str2),"Admin Message: %s has successfully logged into RCON. IP: %s", PlayerName2(i), ip);
				
				MessageToAdmins(MAD_WHITE,str);
		        print(str);
		        new count;
				count++;
				if(count == 3)
				{
				    format(str, sizeof(str), "%s[%d] has been kicked from the server for attempting to log-in to RCON with bad credentials.", pName(i), i);
				    MessageToAdmins(MAD_WHITE,str);
				    SendBanMsg(i, i, "Code Black");
				    Kick(i);
				}
			}
        }
    }
	else
	{
	    MessageToAdmins(MAD_WHITE,str2);
	}
    return 1;
}

forward SetVehicleParamsForPlayerEx(vehicleid,playerid,objective,doorslocked);
public SetVehicleParamsForPlayerEx(vehicleid,playerid,objective,doorslocked)
{
	VehicleStr[vehicleid][playerid][c] = objective;
	VehicleStr[vehicleid][playerid][l] = doorslocked;
	if(IsVehicleStreamedIn(vehicleid, playerid))
	    return SetVehicleParamsForPlayer(vehicleid, playerid, objective, doorslocked);
	return 1;
}

forward PlayerTimeOn(playerid);
public PlayerTimeOn(playerid)
{
    PlayerTime[playerid]++;
}

forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
{
    if(IsPlayerConnected(playerid))
    {
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        tempposx = (oldposx -x);
        tempposy = (oldposy -y);
        tempposz = (oldposz -z);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}

stock CalculatePlayerObjectSlot(playerid)
{
    new SLOT;
	if(!IsPlayerAttachedObjectSlotUsed(playerid, 0))
	{
		SLOT = 0;
	}
	if(!IsPlayerAttachedObjectSlotUsed(playerid, 1) && IsPlayerAttachedObjectSlotUsed(playerid, 0))
	{
		SLOT = 1;
	}
    if(!IsPlayerAttachedObjectSlotUsed(playerid, 2) &&  IsPlayerAttachedObjectSlotUsed(playerid, 1) && IsPlayerAttachedObjectSlotUsed(playerid, 0))
	{
		SLOT = 2;
	}
    if(!IsPlayerAttachedObjectSlotUsed(playerid, 3) && IsPlayerAttachedObjectSlotUsed(playerid, 2) && IsPlayerAttachedObjectSlotUsed(playerid, 1) && IsPlayerAttachedObjectSlotUsed(playerid, 0))
	{
		SLOT = 3;
	}
    if(!IsPlayerAttachedObjectSlotUsed(playerid, 4) && IsPlayerAttachedObjectSlotUsed(playerid, 3) && IsPlayerAttachedObjectSlotUsed(playerid, 2) && IsPlayerAttachedObjectSlotUsed(playerid, 1) && IsPlayerAttachedObjectSlotUsed(playerid, 0))
	{
		SLOT = 4;
	}
	else if(IsPlayerAttachedObjectSlotUsed(playerid, 4) && IsPlayerAttachedObjectSlotUsed(playerid, 3) && IsPlayerAttachedObjectSlotUsed(playerid, 2) && IsPlayerAttachedObjectSlotUsed(playerid, 1) && IsPlayerAttachedObjectSlotUsed(playerid, 0))
	{
		SLOT = INVALID_OBJECT_SLOT;
	}
	return SLOT;
}
// Thanks to Slice
new const g_baValidModels[ ] =
{
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b11111111111011111110110111111111, 0b00000000001111111111111111111111,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b11111111111111111111111110000000,
	0b11100001001111111111111111111111, 0b11110111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b00000001111000000111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111100011111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111011111, 0b11111111111111111111111101111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111100000000000001111111111,
	0b11111111111111111111111111111111, 0b11111111111010111101111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111001111111111111,
	0b11111111111111111111111111111111, 0b10000000000011111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111011111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111101011101111111111, 0b11111111111111111111111111110111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111110011,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111100111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111011111111111111,
	0b10000000000000000000000000000000, 0b00000010000010000000010011111111,
	0b00000000001000000100000000000000, 0b11111111101101100101111000000000,
	0b01110000111111111111111111111011, 0b00000000001111111111111111000000,
	0b10011111110000000000001111001100, 0b11111111101111001100000000011110,
	0b00001110110111111100111111111111, 0b11111111111111111111111111011110,
	0b11111000000011111111111111111111, 0b11111111111111111110111101101011,
	0b01000000000000000111111101110111, 0b11010111111111111111000001111100,
	0b11110011111111111111111001111111, 0b01011111111111111111111111111111,
	0b01111110100001111011111010101011, 0b10001001010101100100001000010000,
	0b10100000000000000001010000101010, 0b00001000001111101010111100100000,
	0b11111111111111111111111010100001, 0b00000000011111111111110101111111,
	0b00001111111111111111110000111100, 0b11011110111111001111011011111011,
	0b11111111111111111111110011001110, 0b11111111111111111111111111111111,
	0b01111111111111111111111110111111, 0b01111000111111111111110111111111,
	0b00011100000000010000000000000111, 0b00001111111100001000000000000000,
	0b10101111001001110111110011111000, 0b01010101010101010110100000101011,
	0b01110111110101011111110100101001, 0b01111111111100101110111011111011,
	0b11111111111111111100101111001000, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b00000000011111111111111111111111, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b11111111000000000000000000000000, 0b00010100101000001111111111111111,
	0b11111111101111011111111111000000, 0b00111111111111111111111100000001,
	0b11110000000000000000000000000000, 0b00000101010101010111111111111111,
	0b11110010110111000011111010000000, 0b11111110111111110111110111010000,
	0b00000000000000011111111111111111, 0b00000000000000000000000000000000,
	0b11111111111111111111111111000000, 0b11111111111111111111111111111111,
	0b11011111111111111111111111111111, 0b00000000000000000000000000000111,
	0b00000000000000000000000000000000, 0b11010111111000000000000000000000,
	0b10110011001000101111111111111111, 0b00011000010111010101011111010111,
	0b11011111111111111111010101111111, 0b11111111111111100000000000000011,
	0b11111111111111111111111111111111, 0b11111111111111111100000101111111,
	0b00000000000000000000000111111111, 0b00011000000001111000000000000000,
	0b11111111111111100111100000000100, 0b11110100011011111111110000000000,
	0b11111110001001111111110000000111, 0b11111111110110000100101010101000,
	0b11111111111111111100000000000000, 0b11111111111111111111111111111111,
	0b11101011111011110011111111111111, 0b11111111111111111111111111111111,
	0b00010001000001111100001111111111, 0b00100000000000000000000000000000,
	0b00000000000000000000000000000000, 0b11111101000000000000000000000000,
	0b11110001110101000001111111111111, 0b00000000000001101111010000010010,
	0b11111111111111111111111110000000, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11100001111100000111100000000000, 0b11100110011111111101011111111011,
	0b00000000000000000000000100111001, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000100110000101100111111001100,
	0b11111111111110000000000000000000, 0b00000000000001111111111111111111,
	0b11000001111111011100000110000000, 0b00000111111101111111111111111111,
	0b00000000001000011110000111010010, 0b00111000100111110011110000000000,
	0b00111111111110101000001001111110, 0b00000000000000100001111100000000,
	0b11111111111111111111111100000000, 0b01111111111111111111111111111111,
	0b01011100001111111110101111110111, 0b11100010111111100000000000111111,
	0b11011000011000110011100011111001, 0b01100110000011110001100000010000,
	0b00000111100000000000000000000100, 0b00010111111101100011100001101010,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b11111111101111111000000000000000, 0b01111000000111100000000111111111,
	0b00000000011111110111111110111111, 0b11111111111111111111111111111111,
	0b00000000101001101111111111111111, 0b11111111111111111111111111111110,
	0b10100001000000111111111111111111, 0b11111111111111111111111111111011,
	0b00000000000000000000000000000011, 0b00000000000000100000000000000000,
	0b01110001111111010000000000010000, 0b11111101111101100011011111111111,
	0b10000000011111111111110101010111, 0b11011111100000010011001110110111,
	0b11010011101011111111111111111111, 0b10101010000010010000001111111000,
	0b11111000101111100000111111010110, 0b11111111100000000000000000000001,
	0b11111111111111111111111111111111, 0b01111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111101111111111,
	0b11111111111111111111111111111111, 0b00000000000001111111111111111111,
	0b00111000000000010001000000000010, 0b00000000000011100000000000000000,
	0b00000000000000000000100000000000, 0b00000000000000000000000000000000,
	0b11110101000000000000000000000000, 0b00011111111000000101001000000111,
	0b11110000011110100011011101000000, 0b01111110111111111111111111111111,
	0b10101000000111110100101111011100, 0b11111111111111111111110000111010,
	0b00000000000000000000011111111111, 0b11111111111111111111111111111110,
	0b00001000111111111111111111111111, 0b00000000000000000000000000000000,
	0b00001111111110000000001111111101, 0b00111110000001111111101110100000,
	0b00001111111101111100011111000100, 0b11101010111101010011000111110000,
	0b11101010000000000000000111010001, 0b10001110110101100101000001110101,
	0b11000011111010101011111111111111, 0b11010110101111110000000000111111,
	0b00011111111111111111111111010100, 0b11111111111111111111111111111111,
	0b00111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b10000000001111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b00000000000000111111111111111111,
	0b00000000000000000000000001000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00011111000000000000000000000000,
	0b00011111111111100111111111111111, 0b00000011111111111111111111111110,
	0b00000000000000000000000000000000, 0b00101100000110000000000000010000,
	0b11100000111110000000001000000000, 0b11111000000000011111111100000000,
	0b11010000111111101011111111111111, 0b11001101010100011100011101000011,
	0b11111111111101010011110011100111, 0b01000000000111111001101111111111,
	0b00000000111010111111110010000111, 0b11111111111000000000001111111111,
	0b11111111111111111111111111111111, 0b11111111111011110111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b00000000000001100000001111111111, 0b00000000000000000000000000000000,
	0b11100000000000000000000000000000, 0b00000000000000000000000000000001,
	0b11111111111111111111110000010000, 0b00000111111111111111111111111111,
	0b11111111111111111110100000000000, 0b11111111111111111111111110111111,
	0b00000011100001111111111111111111, 0b00000000001100000000000000000000,
	0b01100110001011010000000000000000, 0b11111111111111111111111111111111,
	0b00000111111111111111111111111111, 0b00000000000000000000000011111110,
	0b11111111110100000000000000000000, 0b00000000000000000111111111101011,
	0b01100000000000000000000110011100, 0b11111111111111111111111111101010,
	0b11111100000000000111111111111111, 0b00000000000000000000000001111111,
	0b11111111000000000000000000000000, 0b11111111111111111111111111111111,
	0b11111111111111111111011111111111, 0b11000000001000000000000011011001,
	0b11011111111111111111111111111111, 0b11100000011000000000011111111110,
	0b00000000001111100011111111111111, 0b00011110111111000000000000000000,
	0b11001111111100001001011111110100, 0b00110001110001111000011101011110,
	0b00000000000000000000000001110110, 0b11111111111111111100000000000000,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b00111111111111111111111111111111,
	0b00000000000000000000000000000000, 0b11000000000000000000000000000000,
	0b00000000000000011111111111111111, 0b11101111111111110100001000000000,
	0b00001010000000001111111111111111, 0b00001100000110011000000000000000,
	0b01010011111111111111111111000000, 0b11000001111111111100000000000100,
	0b11111111111111111111111111111111, 0b11001111110000000000111111111111,
	0b11111111111111111111111111111111, 0b00001111111111111111111111011111,
	0b00000011100000000000111000100000, 0b11111111111111111110000000100000,
	0b11111111111001111111111111111111, 0b11111111111111111111111111111111,
	0b00000000000000000000000011111111, 0b10000000000000000000000000000000,
	0b11111111111111111111111111111111, 0b11111111111111111111111111001111,
	0b00000000000000000111111000001111, 0b00000000000000000000000000000000,
	0b11110111100000000000000000000000, 0b00111111111100001111111111111111,
	0b10110111101010010000000000000000, 0b11010000111111110001011011101010,
	0b10000011100000101101001011010000, 0b11111111111110000100000010111101,
	0b11110011011111110100001100011111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b00111000000110011111111111111111,
	0b10001111100000000000000000000000, 0b10000000000000001011111010000000,
	0b11100100000001111000000000000000, 0b00000000000000000000000000000011,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111011,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b00001110001111111101111001011011,
	0b00011110011000011100011000111100, 0b11000000001011111111111110010001,
	0b01111111111111111101101111111111, 0b00111111111111111010100001110010,
	0b01111111111000000100000001011000, 0b00000000001110000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000111000000000000000,
	0b01000001000100000011101000000001, 0b11001111100110110000000000111010,
	0b00000000000000000000000000000000, 0b11111000000000000100000000000000,
	0b01000000001000000001111110111111, 0b11111111111011100111000000000000,
	0b11111111111111111111111111111111, 0b00001111111111111111111111111111,
	0b11111111110000000000000000000000, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111100001111,
	0b11111111111111111111111111111111, 0b01111111101111011111111111111111,
	0b00100001000000000000000000000010, 0b10110111011001100111011000001000,
	0b00000000001000000000000010000111, 0b10000100000000011000001111100000,
	0b00000000000000000000000000000100, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b11111111111111111000000000000000,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11010111111111111111111111111101, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111100000011111111111111111111,
	0b11111111111111111111111111110011, 0b11111111111111111111100011111111,
	0b11111111111111111000000111111111, 0b11111111111111000011111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111110111111111, 0b00000000111101111111111111101111,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b11111111111111100000000000000000,
	0b00000001111111111111111111111111, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111101111111111111111, 0b00000111111111111111111111111111,
	0b00001111111111111111111111111111, 0b01110100111101000100000111110000,
	0b10101000000000000000000000000001, 0b00000000111101000000000000000011,
	0b00000000111111000000000000000000, 0b00001001000111000000000000000000,
	0b00100010100000100000000000000000, 0b11111111111110001100000000100100,
	0b11111111111111111111111111111111, 0b01110000011101100011111001111010,
	0b11111000000000000000000000011110, 0b11000001111101100000111111111111,
	0b00000000011111111111111111101110, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b11111111111111111111111100000000,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b01010111111111111111111111111111,
	0b01010101010101010101010101010101, 0b01010101000101010101010101010101,
	0b01010101010101010101010101010101, 0b10101010101010000101010101010101,
	0b01111010111111111111111111111010, 0b00000000111010101101100000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b11110111111111000000000000000000, 0b11111111111111111111110100011111,
	0b11110000000000000000000000000101, 0b11111111111111111111111011111111,
	0b11111111111111111111111111111111, 0b11111101101101101100111111100001,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b00000000000000000000000000011111,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000101011000000000000, 0b01111011000000100000000000100000,
	0b11000011111111010000111111011000, 0b11111011100011110110111001111001,
	0b11001101111111110110000111100111, 0b00000101011110110000000001111110,
	0b11111111111111110000000000000000, 0b11111111110111111111111111111111,
	0b11111111111111111111111111111111, 0b00100011011111111111111111111111,
	0b00000000000000000000000000000001, 0b00000000000000000000000000000000,
	0b11111111000000000000000000000000, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b00000111111111111111111111111111, 0b00000000000000000000000000000000,
	0b11111111111111111111111111111111, 0b00000000001111111111111111111111,
	0b00000000010000000000000000000001, 0b00000011100000000000000000000000,
	0b00000000000000000000001111101010, 0b11111111111111110000000000000000,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b11111111111111111111111111111111, 0b11111111111111111111111111111111,
	0b00001111111111111111111111111111, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00100000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000,
	0b00000000000000000000000000000000, 0b00000000000000000000000000000000
};

forward IsValidObjectID( iModel );
public IsValidObjectID( iModel ) // Also Slice. Changed the name for compatability.
{
	if ( !( 0 <= iModel <= 20000 ) )
		return 0;
	else
	{
		switch ( iModel )
		{
			case 1326, 320, 16330, 13051, 1385, 1382, 1373:
				return 0;

			//case 18631 .. 19053, 19901:
			//	return 1;
		}

		return ( g_baValidModels[ iModel >>> 5 ] & ( 1 << ( ( iModel ) & ( cellbits - 1 ) ) ) ) ? 1 : 0;
	}
}

stock CreateCar(playerid, thingid, orderid)
{
	new
	    string[128],
		Float:vPos[ 4 ];
	GetPlayerPos ( playerid, vPos[ 0 ], vPos[ 1 ], vPos[ 2 ] );
	GetPlayerFacingAngle( playerid, vPos[ 3 ] );
	if ( PlayerInfo[playerid][PlayerDynCar] != -1 && !IsPlayerAdmin( playerid) ) CarDeleter( PlayerInfo[playerid][PlayerDynCar] );

	Vehicle[ orderid ] = AddStaticVehicleEx(thingid, vPos[ 0 ], vPos[ 1 ], vPos[ 2 ] + 3, vPos[ 3 ], -1, -1, 40);
    DynamicV[Vehicle[ orderid ]] = 1;

	PlayerInfo[playerid][PlayerDynCar] = Vehicle[ orderid ];
	SetVehicleVirtualWorld( Vehicle[ orderid ],GetPlayerVirtualWorld( playerid ) );
	PutPlayerInVehicle( playerid, Vehicle[ orderid ], 0);
	format(string, sizeof(string), "{FFFFFF}Spawned a {FFFFFF} %s {FFFFFF}[{000000}ID: %d{FFFFFF}]",VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400],thingid);
	SendClientMessage(playerid, White, string);

	TogglePlayerControllable(playerid, true);
	return 1;
}

// Timers
forward TwentyMinuteTimer();
public TwentyMinuteTimer()
{
	CExport__NewWantedVehicle();
	RegularPlayer();
}
